I tried making a script that changes the players speed but it is not working and there is no error in Output
script.Parent.ClickDetector.MouseClick:connect(function(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid~=nil then wait(0.01) humanoid.WalkSpeed = 150 end end)
that is because the ClickDetector.MouseClick
takes the argument of the player i believe sorry if i am wrong. You can access the character by doing player.Character
.
script.Parent.ClickDetector.MouseClick:connect(function(player) local humanoid=player.Character:findFirstChild("Humanoid") if humanoid~=nil then wait(0.01) humanoid.WalkSpeed = 150 end end)
When the MouseClick event fires, it returns the player that clicked, in your case, you named it "hit". I would change it to "player" so it's not confusing. Also, since the event returns a player, line 2 is looking for a Humanoid in the Players service. Just replace line 2 with local humanoid = player.Character.Humanoid
. Note that I used "player" instead of "hit," since I recommended changing the variable name.