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

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

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

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.

1 comment

0

oh okay thanks

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