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

How different is the use of waitforchild from this?

local RocketScript = WaitForChild(script, 'Rocket') local RocketScript2 = game:WaitForChild('Rocket')

I dont understand what WaitForChild(script,'Rocket' ) means?

1 answer

✓ Accepted answer

the Colon, : is used to call a function on an object, this is what we usualy refer to as a method. Methods have the self parameter in them automatically, which refers to the object the method is being called upon.

This is why WaitForChild(script,"Rocket") is doing the same thing as script:WaitForChild("Rocket") as script will be self when using the Method variant.

Eg.

function Thing:Rename(Name)
    self.Name = Name
end

would be the same as

function Rename(Thing,Name)
    Thing.Name = Name
end

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