Okay, so I made this script which is supposed to make the player run
It works perfectly in a Studio test but doesn't work at all once I'm in an actual server, please help!
Here is my code:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local character = player.Character if not character or character.Parent == nil then character = player.CharacterAdded:wait() end local sprint = Instance.new("BoolValue",character) sprint.Name = "sprint" local humanoid = character.Humanoid humanoid.WalkSpeed = 10 local debounce = false mouse.KeyDown:connect(function(key) if key:byte() == 48 and debounce == false then humanoid.WalkSpeed = 20 debounce = true for i=1,20 do wait() game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView + 1 end end end) mouse.KeyUp:connect(function(key2) if key2:byte() == 48 and debounce == true then debounce = false humanoid.WalkSpeed = 10 for i=1,20 do wait() game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView - 1 end end end)
I would really appreciate it if you could help me out, thanks!