Jul 5, 2024
print("hello world")
game.workspace["part"].transparency = 0.75
game.workspace["part"].anchored = false
local variableName = value
local name = "scrips"
local function functionName()
-- code block
end
local function addNumbers(num1, num2)
local result = num1 + num2
print(result)
end
functionName()
return
to send values back to where the function was called.if condition then
-- code block
end
if
condition is false.if
fails.local arr = {"scrips", "is", "cool"}
print(arr[1]) -- Outputs: scrips
table.find
: Finds an index of a value.table.remove
: Removes an element by index.table.insert
: Adds a new element to the table.local dict = {name = "scrips", favoriteColor = "green"}
print(dict.name) -- Outputs: scrips
task.wait
: Pauses script execution for a specified time.findFirstChild
: Finds the first child object with a specified name.getChildren
: Returns a table of all children objects within an instance.while true do
-- code block
task.wait(1)
end
repeat
-- code block
until condition
for i = 0, 10, 1 do
-- code block
end
for index, value in ipairs(myTable) do
print(index, value)
end
local part = game.workspace.Part
part.Touched:Connect(function()
part.Transparency = 0.5
end)
game.Players.PlayerAdded:Connect(function(player)
print(player.Name)
end)