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

I dont know how I can put a variable into a path i have tried it with [] (l.2+l.4)?

Asked by 2 years ago
Edited 2 years ago

script.Parent.Triggered:Connect(function(speedUp) -- Proximity promt btw speedUp.Parent.Parent.Workspace[speedUp].Humanoid.WalkSpeed = 30 -- here
wait(10) speedUp.Parent.Parent.Workspace[speedUp].Humanoid.WalkSpeed = 16 -- here too
end) -- I am new to scripting btw

Output Error:

Workspace.Spilled Coke.Model.Part.ProximityPrompt.Script:2: invalid argument #2 (string expected, got Instance)

1 answer

Log in to vote
0
Answered by 2 years ago

You're only getting the player's instance, not the player's username. You will need to put a .Name after it.

speedUp.Parent.Parent.Workspace[speedUp.Name].Humanoid.WalkSpeed = 30

And please use a code block next time. It should be above your question/answer box.

0
oh okay thanks michi2309_2 0 — 2y
Ad

Answer this question