Can someone explain this?

Hello everyone,

So I have watched a youtube tutorial and something caught my attention, when he wrote his functions it was something like this

local function FunctionName(Player : Player , SelectedTool : Tool)
end

I’ve searched everywhere but didn’t find anything Can someone explain what does : do in this case? and if there is a wiki to it can you please link it to me?

Thank you.

I could be wrong, but I’m pretty sure those are just comparisons, and the : separates the difference between a custom parameter name (Examples being Plr, Onion, WasTriggered), and the actual ClassNames (Examples being Attachment, Tool, AngularVelocity)

So simply put, this function:

local function FunctionName(Player : Player , SelectedTool : Tool)
end

Is referring to 2 variables with separations, the Player being a Player Class Object, and the SelectedTool being a Tool Class Object

local function FunctionName(PlayerObject, ToolObject) -- It would basically be this

end

and what if the Player Parameter for example wasn’t a Player class but something else? would it error or cause other issues in the function?

That’s just assigning the type that a variable is/will be.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.