Lua syntax

lua syntax chunk ::= {stat [`;´]} [laststat [`;´]] block ::= chunk stat ::= varlist `=´ explist | functioncall | do block end | while exp do block end | repeat block until exp | if exp then block {elseif exp then block} [else block] end | for Name `=´ exp `,´ exp [`,´ exp] do […]

Lua syntax Read More

Lua functions

lua functions function myFunction() — Start with ‘function’, give it a name — Do something amazing… end — Finish with ‘end’ myFunction() — Call the function later in the code

Lua functions Read More

Lua variable

Lua variable — Variables are global by default: globalVariable = 10 — To make a variable local: local localVariable = 20 lua variable — Private Variable local name1 = “John” — Public Variable name2 = “Jane” print(name1) print(name2)

Lua variable Read More

Roblox on touch script

roblox on touch script script.Parent.Touched:Connect(function(player) local part = script.Parent part.CFrame = part.CFrame + Vector3.new(0, -8, 0) player.leaderstats.Power.Value = player.leaderstats.Power.Value + 4 wait(120) part.CFrame = part.CFrame + Vector3.new(0, 8, 0) end)

Roblox on touch script Read More

Lua operators

lua operators == — Equal to whatever <= — Less than or equal to >= — Greater than or equal to < — Less than > — Greater Than ~= — Doesnt equal # — Length of something lua operators == equal to ~= not equal to < less than > greater than <= less […]

Lua operators Read More