vince

Dictionary

Dictionaries are an extension of arrays. While an array stores an ordered list of items, a dictionary stores a set of key-value pairs. To create a dictionary table, define each key followed by = an...

Tick()

Tick() tells you how much time has passed since 1 Jan 1970 -- you can use it to figure out how much time has passed since a game started etc Workspace/Part/Script ruby local gameStarted = tick() lo...

  • Updated 3 months ago by vince
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...

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...

Learn how to play Texas hold'em

7 cards (eventually) 5 are laid out publicly (eventually) as community cards 2 are your hold (i.e. secret) cards player with best hand wins following example is for 3 players every player takes tur...

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...

Spawn and Delay and Coroutine

Creates a new thread so code can run concurrently ServerScriptService/Script ```ruby local function printHello() while true do wait(1) print("Hello") end end local functio...

  • Updated 3 months ago by vince
Random

Generate a random number between 1 and 20 ruby local randomNumber = math.random(1,20) With no arguments, returns a random number in the range [0, 1). That is, zero up to but excluding 1. With 1 ar...

  • Updated 3 months ago by vince
Lua scripting

Quick and easy examples

Comments

Comments ruby --[[ print("hi") -- no action --]] Now, if we add a single hyphen to the first line, the code is in again: ruby ---[[ print("hi") --> "hi" --]]

  • Updated 3 months ago by vince
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 3 months ago by vince
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 3 months ago by vince
Using Blender with Roblox

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

  • Updated 3 months ago by vince
Animate a Humanoid

Add script to Model Workspace/Fan/Script ruby local animation = script:WaitForChild('Animation') local humanoid = script.Parent:WaitForChild('Humanoid') humanoid:LoadAnimation(animation):Play() A...

Rig a custom NPC

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

Do damage when NPC touches player

Make an NPC named Giraffe damage player when it's torso touches a player Workspace/Giraffe/Torso/Script ```ruby local brick = script.Parent local touched = false -- debounce local function ImTrigge...

Make NPC follow/chase players

Make an NPC [with Humanoid inside] named Giraffe patrol chase the closest player Workspace/Script ```ruby local DELAY = 2 local giraffe = game.Workspace.Giraffe local humanoid = giraffe.Humanoid l...

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 between two points like a patrol

Make an NPC [with Humanoid inside] named Giraffe patrol between two objects named GreenFlag and PurpleFlag. Note the line that says humanoid.MoveToFinished:Wait() - this pauses the script till the ...