Humanoid update problem

This script change character walk speed.

script.Parent.Touched:Connect(function(hit)
	
	script.Parent.CanTouch=false
	local speed=script.Parent.Parent.walk	
	print(speed.Value)	
	hit.Parent.Humanoid.WalkSpeed=speed.Value	
	wait(1)	
	script.Parent.CanTouch=true
	return
		
end)

But problem is when after this I manually change Humanoid.WalkSpeed value and i step on part with this script again then it not change Humanoid.WalkSpeed anymore. So i need to change values of speed.Value, reset character or do +1 and -1 like

    hit.Parent.Humanoid.WalkSpeed=speed.Value-1	
	hit.Parent.Humanoid.WalkSpeed=speed.Value+1	

and then it work.

But question is why Humanoid doesn’t allow to replace WalkSpeed with same value second time? It’s nonsense. It’s looks like it remember previous value and it doesnt allow to accept it again. It’s a joke or what?

2 Likes

If I understand correctly: the issue you are having is that you are manually updating the WalkSpeed on the client-side(your computer), while the part that you touch changes the WalkSpeed through the server. because of filtering enabled, only the client sees your manually modified Walkspeed.

The client has full physics control over your character so you can travel at your new WalkSpeed, however, the server doesnt see that your walkspeed changed, so when you step on the part to update it, the server sees that the walkspeed hasn’t changed and doesnt change it. I hope this explains your problem.

4 Likes

Thanks. That works. I realized that I was using local script to change CameraOffset but also i was changin character size and walkspeed ther, and then i had another serverscript which was changing character walkspeed so this server script didn’t saw values changed by local script? But why server script just do not send new values to the client instead of comparing them?

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.