Roblox

Tips and tricks and scripts

UserId

The UserId uniquely identifies every user account on Roblox. Unlike Instance.Name of a Player, which may change according the user’s present username, this value will never change for the same acco...

Data Store

used to save data which should persist between game sessions shared per game essentially a dictionary Each value can be indexed by a unique key which includes the player’s UserId network calls may ...

Leaderboards

ServerScriptService/PlayerSetup ```lua local function onPlayerJoin(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local gold = Instance.new("Int...

CFrame

short for Coordinate Frame it is a data type used to rotate and position 3D objects contains global X, Y, and Z coordinates as well as rotation data for each axis contains helpful functions for wor...

Pathfinding

find [the closest] path for an NPC to move from point A to point B ```lua local PathfindingService = game:GetService("PathfindingService") -- Variables for the zombie, its humanoid, and destination...

  • Updated 11 days ago by vince
Module Scripts

code within module scripts can be used by other scripts makes maintaining code easier since changes only need to be made to one module script ServerStorage/MoneyManager ```ruby local MoneyManager =...

Remote Functions

RemoteFunction is a two-way communication (vs one-way for a RemoteEvent) Code that calls it waits to hear back before going to the next line Step 1: Create ReplicatedStorage Event Add RemoteFunctio...

Remote Events

Lets you do stuff from the client to the server so everyone sees it Because of filteringEnabled if you delete a part from localScript only you see RemoteEvent is a one-way communication (vs two-way...

UserInputService

only works as a localscript StarterPlayer/StarterPlayerScripts/LocalScript ```ruby local UIS = game.GetService("UserInputService") function doIt(input, gameProcessedEvent) if input.KeyCode == Enu...

Client-Server Model

Client - your personal computer, phone, tablet, or game console is a client. Every other unique player in the game is also a client. Server - All clients (players) in the game are connected to a Ro...

GUI

Add ScreenGui to StarterGui rename it to MainGui etc Add TextButton to ScreenGui Add LocalScript to ScreenGui StarterGui/MainGui/LocalScript ```ruby local button = script.Parent.TextButton button.M...

  • Updated 23 days ago by vince
Lua scripting

Quick and easy examples

Roblox Studio Explorer

The Explorer window shows a hierarchical list of every object inside a place It uses the concept of parenting to organize all of the objects. If an object has any children, it will show a small arr...

  • Updated 23 days ago by vince
Using Blender with Roblox

https://devforum.roblox.com/t/my-experience-with-blender/216153

  • Updated 26 days ago by vince
Rig a custom NPC

Get RigEdit (https://www.roblox.com/library/4486409103/RigEdit-Plus) Watch https://youtu.be/8StIer18lpY

Get closest player to an NPC

```ruby local npcHRP = NPC.HumanoidRootPart local function GetNearestPlayer(minimumDistance) local closestMagnitude = minimumDistance or math.huge --minimumDistance is a number in studs ...

Move NPC to a point

Move an NPC named Giraffe to an object named GreenFlag Workspace/Script ```ruby local giraffe = game.Workspace.Giraffe local humanoid = giraffe.Humanoid local pointA = game.Workspace.GreenFlag huma...

Clone Objects

Workspace/Script ```ruby local object = game.Workspace.PartToClone local clonedObject = object:Clone() clonedObject.Parent = game.Workspace clonedObject.Position = Vector3.new(5,0.5,5) clonedObject...

Damage or Heal player when player touches something

Workspace/Part/Script ```ruby local brick = script.Parent local function Touched(Part) if Part.Parent:FindFirstChild("Humanoid") then Part.Parent.Humanoid:TakeDamage(10) end end br...

Do something when Tool is equipped or unequipped

If you have a tool named "Shield" in StarterPack StarterPack/Shield/Script ```ruby local Tool = script.Parent local function toolEquipped() print("Tool Equipped") end Tool.Equipped:Connect(tool...