Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you use a function?

1 answer

✓ Accepted answer

A function is a set of things that happens when it is called.

--Here is one way to do it

local function Func ()
print("Hello!")
end
--Some other code can go here
Func()

-- Heres a way for it to wait for something to happen! you dont need to set it up like this but i prefer this way

workspace.BasePlate.Changed:connect(function()
print("Something happened to the plate!")
end)

--Heres the other way

local function Listen()
print("Something happened to the plate!")
end
workspace.BasePlate.Changed:connect(Listen)

3 comments

0

This is a great answer, but also consider watching this video for further explanation. https://www.youtube.com/watch?v=xzEBppiO9xs

0

What he said ^

This discussion is preserved as it was. New answers, comments, and votes are closed.