I am using a HopperBin.
SP = script.Parent walkspeed = script.Parent.Players.LocalPlayer.Humanoid.WalkSpeed SP.Selected:connect(function() if walkspeed == 16 then walkspeed = 16+16 end end)
My problem is I don't know how to change my directory to my player or the LocalPlayer using the tool. If I can find out how to get to my player I can pretty much do the rest and find out and figure out any other errors. Is LocalPlayer usable to find my in-game character? I searched in Wiki and I think theres something about Player...Idk.
There are a few issues here... First off, the Humanoid is in the Character, not the Player, so it would be:
Humanoid = game.Players.LocalPlayer.Character.Humanoid
Also, WalkSpeed is a property of the Humanoid, so it can not be a variable, you would have to do:
if Humanoid.WalkSpeed == 16 then -- Code here end
LocalPlayer
is the Player object, not the Character Model.
You can use the Character
property of Player
to get its associated Character model, however.
You are making a classic mistake: when you set a variable to some property, as you are trying to do in line 2 here, the variable holds the value of that property, not a reference to the property! Your code cannot change the WalkSpeed unless it maintains a reference to the Humanoid:
SP = script.Parent humanoid = script.Parent.Players.LocalPlayer.Character.Humanoid SP.Selected:connect(function() if humanoid.WalkSpeed == 16 then humanoid.WalkSpeed = 32 end end)