Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you use a function?

Asked by 9 years ago

What is a function used for?

1 answer

Log in to vote
1
Answered by 9 years ago

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)

0
This is a great answer, but also consider watching this video for further explanation. https://www.youtube.com/watch?v=xzEBppiO9xs NoahWillCode 370 — 9y
0
What he said ^ bubbaman73 143 — 9y
Ad

Answer this question