Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by
Asceylos 562 Moderation Voter
6 years ago

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

0
Ohh thank you so much! midtownmadness23 15 — 6y
Ad

Answer this question