-
What do you want to achieve? Keep it simple and clear!
I want to fix my local script in startergui, it doesn’t change the players walkspeed after they respawn -
What is the issue? Include screenshots / videos if possible!
My local script doesn’t change the players walkspeed after they respawn -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried YT and Devforum
Here is my code:
-- Variables
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local sprinting = false
player.CharacterAdded:Connect(function(newChar)
character = newChar
humanoid = newChar:WaitForChild("Humanoid")
end)
script.Parent.SprintButton.MouseButton1Click:Connect(function()
if humanoid.Sit == false then
if character:FindFirstChild("Arrested") then
if character:FindFirstChild("Tased") then
if character.Tased.Value == false then
if character.Arrested.Value == false then
if sprinting == false and humanoid.Sit == false then
sprinting = true
humanoid.WalkSpeed = 32
end
end
end
else
if sprinting == false and humanoid.Sit == false then
sprinting = true
humanoid.WalkSpeed = 32
end
end
else
if sprinting == false and humanoid.Sit == false then
sprinting = true
humanoid.WalkSpeed = 32
end
end
end
if humanoid.Sit == false then
if character:FindFirstChild("Tased") then
if character.Tased.Value == false then
if character:FindFirstChild("Arrested") then
if character.Arrested.Value == false then
if sprinting == true then
sprinting = false
player.Character.Humanoid.WalkSpeed = 16
end
end
else
if sprinting == true then
sprinting = false
player.Character.Humanoid.WalkSpeed = 16
end
end
end
end
else
if sprinting == true then
sprinting = false
player.Character.Humanoid.WalkSpeed = 16
end
end
end)