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

How can this script work if the parameters are not specified?

So basically this script codes a Speedboost, so when the player touches it, it makes him go faster

--Variables local speedboost = script.parent --Function

function steppedon ""(part)""

""local parent = part.Parent""

if game.Players:GetPlayerFromCharacter(parent) then

parent.Humanoid.Walkspeed = 50

wait(2)

parent.Humanoid.Walkspeed = 16

end

speedboost.Touched:connect(steppedon)


The fragments of the script surrounded with ("") are the ones that i don't understand. Why does he put there "part" and doesn't specify what the variable "part" means? Also, how does the #local parent = part.Parent# part work if he didn't, specify, again, what part means?

I will be thankful for any kind of help :)

1 answer

Because the Touched event already has a part parameter so it automatically defines part as the part that has been touched.

1 comment

0

Ohh thank you so much!

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