What goes in between the parentheses?
function example()
end
What goes in between the parentheses?
function example()
end
In the parentheses of such a function, what could be in there is what is known as a parameter. Parameters are variables created by the function that can stand for basically anything. Example:
function Weld(p1, p2) -- Two parameters; you can have more than one
local w = Instance.new("Weld", game.JointsService)
w.C1 = p2.CFrame:toObjectSpace(p1.CFrame)
w.part0 = p2
w.part1 = p1
end
Weld(game.Workspace.Part, game.Workspace.Wedge)
--[[
Please note that all parameters must be filled in for the function to work.
If no parameters are defined, you'll get an error or the script will be a dud.
--]]
Example:
function Print(text) -- you can put anything between the parentheses. Strings, objects, properties
print(text)
end
Print('Hello world!') -- prints 'Hello world!' in the output
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
thanks.