Hello, I am doing a simulator game where during the game you can obtain speed through time, but I want there to be a limit on the speed of every player.
It will still go through the limit, and there aren’t errors in the Developer Console.
I’ve been searching a script like this or how to find a player’s humanoid through a server-script to detect it. This is my script:
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
if Character.Humanoid.WalkSpeed >= 101
then
Character.Humanoid.WalkSpeed = 100
end
end)
end)
Doesn’t that only check when the player joins?
You want a script that keeps running during the game. I’d look into your script that changes the speed and put the change limit there.
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
Character = player.Character or Player.CharacterAdded:Wait()
Character:WaitForChild("Humanoid").Running:Connect(function()
if Character.Humanoid.WalkSpeed >= 101
then
Character.Humanoid.WalkSpeed = 100
end
end)
end)
end)
You are right. When the speed increased it gave them the speed and after 1 second they had 100 speed, I tried doing that or running the script earlier.