Hello. I am making a running script where when you hold down "e" it will start running faster. Here is my first script which is when you press "e" you will run,
local mouse = game.Players.LocalPlayer:GetMouse() local running = false mouse.KeyDown:connect(function(key) key = string.lower(key) if string.byte(key) == "e" then running = true local keyCon = mouse.KeyUp:connect(function(key) if string.byte == "e" then running = false end end) script.Parent.Humanoid.WalkSpeed = 25 repeat wait() until running == false keyCon:disconnect() script.Parent.Humanoid.WalkSpeed = 16 end end)
Here is another script that gives the script above to the player whenever he or she dies.
game.Players.ChildAdded:connect(function() end) game.Workspace.ChildAdded:connect(function(newPlayer) local h = newPlayer:FindFirstChild("Humanoid") if h ~= nil then if workspace:FindFirstChild(h.Parent.Name) ~= nil then local run = script.Parent:clone() if workspace.FindFirstChild(h.Parent.Name) ~= nil then run.Parent = h.Parent run.Disabled = false end end end end)
I was just wondering if these 2 scripts were right. Thank you. :D