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

What goes in the parentheses of a function?

What goes in between the parentheses?

function example()

end

2 answers

✓ Accepted answer

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.
--]]

1 comment

0

thanks.

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.