Help with Humanoid WalkSpeed and JumpPower

Hello! :roblox: Devs

So, I am having some trouble getting the player’s walkspeed and also jump power back to normal. It was working when I a while ago but whenever I try using it now everything else works except for changing the humanoid’s walkspeed and jump power.

Here’s my code:

local s = script.Parent
local sp = s.Parent
local sColor = s.Parent.Stable
local bColor = s.Parent.StableBorder
local ws = game.Workspace
local player = game.Players:FindFirstChildWhichIsA("Player")

s.MouseButton1Click:Connect(function()
	if s.Online.Value == false and sp.Button5.Online.Value == true then
		s.Online.Value = true
		wait(0.015)
		s.BackgroundColor3 = sColor.Value
		s.BorderColor3 = bColor.Value
		s.Text = '✔️'
		wait(0.55)
		sp.title.Text = 'Lighting Fixed!'
		sp.completed.Visible = true
		wait(0.75)
		ws.FixableLight.Light.BrickColor = BrickColor.new("Daisy orange")
		ws.FixableLight.Light.SurfaceLight.Enabled = true
		ws.FixableLightTwo.Light.BrickColor = BrickColor.new("Daisy orange")
		ws.FixableLightTwo.Light.SurfaceLight.Enabled = true
		wait(0.05)
		player.Character.Humanoid.WalkSpeed = 12
		player.Character.Humanoid.JumpPower = 40
		wait(3.5)
		sp.Parent:Destroy()
	end
end)

Any help would be appreciated!

This would simply not work. It would find the first child of the class of player even if the game has possibly 50 players.

Instead replace:

with s.MouseButton1Click:Connect(function(Player)

1 Like

This is a LocalScript, so use LocalPlayer ?

MouseButton1Click event listeners don’t get anything as an argument, especially not the player

1 Like

I’m not sure if it is or if it isn’t. If it is, she/he uses LocalPlayer, if not they use s.MouseButton1Click:Connect(function(Player)

It isn’t a local script however I did forget to use player as an argument so that may be the reason. (Sorry, I’m pretty new to scripting.)

It doesn’t pass anything, regardless of it not being a localscript. And ui should never be handled on the server anyway.

2 Likes

I just got it to work now! Thank you all so much! :grin: