Player WalkSpeed Not Changing

Hey guys, im getting no errors the first past before the wait works, and it stops my walkspeed, but then after I change it back and the jumppower it wont change and I get stuck, any help??

local click = script.Parent.ClickDetector



click.MouseClick:Connect(function(player)
    local anim = player.Character.Humanoid:LoadAnimation(script.Parent.Animation)
    
    player.Character.Humanoid.WalkSpeed = 0
    player.Character.Humanoid.JumpPower = 0
    anim:Play()
    wait(4)
    anim:Stop()
    player.Character.Humanoid.WalkSpeed = 16
    player.Character.Humanoid.JumpPower = 50
end)

Thank you

2 Likes

I think you should add anim:Play() under the player.Character.Humanoid.Jumpower = 50

1 Like

Uhh what youy mean, I play the bandage animation then it heals and allows you to move

1 Like

Sorry if I’m misunderstanding something, but it seems as if you’re saying specifically the JumpPower of the player doesn’t change back to normal after the wait? Could you please elaborate on this and tell us if there are any errors in the output?

Also as a recommendation, I suggest that you should add a debounce to your function so that the function will not execute if it has already been executed.

1 Like

So after the wait, nothing works. WalkSpeed, jumppower nothing!

1 Like

I see. Are there any errors within the output?

1 Like

No errors at al;, it’s very confusing at is works at the top but not the buttom

1 Like

What do you mean by that, could you explain a little more?

1 Like

Also, as another question, is the character stuck for a duration of time or the whole entire time?

1 Like

You don’t call the AnimationId, script.Parent.Animation is fine

1 Like

The animation is fine it’s everything under the wait

1 Like

You only added the ClickDetector unto the event, but wheres the part? For example if you are using an object to interact with the player what you should do is

Part.ClickDetector.MouseClick:Connect(function(player)

not ClickDetector.MouseClick:Connect(function(player)

1 Like

It would be even better if you showed us your output so that we can see what is actually happening.

1 Like

Here’s a gif, (the second time the animation plays that’s just me clicking again my bad)

But see no errors, I can’t move or jump after the wait()

1 Like

it’s not working for me, I can send you the model??? And Yes I put the correct animation ID because it’s playing…

1 Like

Do this instead and see what happens.

anim:Play()
anim.Stopped:Wait()
wait(4)
------- your script here

1 Like

The thing is, you probably didn’t make the whole animation to finish first before moving on. It would be super cool if you showed us a screenshot of your output!

1 Like

You are wrong. You load an instance, not an int64 or string.
Please make sure you research the API if you are unsure of any information.
Please also don’t spam replies. You can always edit anything you put instead.


@NinjazBeast

  • It’s possible you are deleting the script or parenting object, and you are unaware of it. After clicking the part, make sure it still exists in workspace.
  • Keep a variable for your Humanoid. At the beginning of the function, put: local humanoid = player.Character.Humanoid
  • Something else may be changing walkspeed.
  • If none of the above fix the issue, try putting your walkspeed script in a LocalScript.

Please also provide a video of your problem.

2 Likes

Look up in the chat for the gif

script.Parent is finding the animation.

1 Like

There is no gif.

That line of code is still good tho.
Instead of re-typing it over and over, you just have a variable :slight_smile:

1 Like