I have a run script, but it only works for a little bit, then it stops working and you have to re-click the shift button. Sometimes it makes you go slower.
game.Players.PlayerAdded:connect(function(player)
local RunS = script.RunFunction:clone()
RunS.Parent = player.Character
RunS.Disabled = false
player.CharacterAdded:connect(function(Character)
local RunS = script.RunFunction:clone()
RunS.Parent = player.Character
RunS.Disabled = false
end)
end)
local Player = game.Players:GetPlayerFromCharacter(script.Parent)
C = script.Parent
Mouse = Player:GetMouse()
Debounce = false
Mouse.KeyDown:connect(function(key)
key = string.lower(key)
if string.byte(key) == 48 then
if Debounce == false then
Debounce = true
C.Humanoid.WalkSpeed = 40
for i=1,10 do
game.Workspace.CurrentCamera.FieldOfView = (70 + (i * 2)) – This makes the players camera go farther away from the player so it makes a nice run effect. Since the camera’s current view is 70 we just made it 90.
wait()
end
end
end
end)
Mouse.KeyUp:connect(function(key)
key = string.lower(key)
if string.byte(key) == 48 then
if Debounce == true then
Debounce = false
C.Humanoid.WalkSpeed = 16
for i=1,10 do
game.Workspace.CurrentCamera.FieldOfView = (90 - (i * 2)) – This makes the players camera go closer to the player. Now the camera makes the walking effect. The camera view is now 70.
wait()
end
end
end
end)
local Player = game.Players:GetPlayerFromCharacter(script.Parent)
C = script.Parent
Mouse = Player:GetMouse()
Debounce = false
Mouse.KeyDown:connect(function(key)
key = string.lower(key)
if string.byte(key) == 48 then
if Debounce == false then
Debounce = true
C.Humanoid.WalkSpeed = 40 -- Change to what you want the players walkspeed to be.
for i=1,10 do
game.Workspace.CurrentCamera.FieldOfView = (70 + (i * 2)) -- This makes the players camera go farther away from the player so it makes a nice run effect. Since the camera's current view is 70 we just made it 90.
wait()
end
end
end
end)
Mouse.KeyUp:connect(function(key)
key = string.lower(key)
if string.byte(key) == 48 then
if Debounce == true then
Debounce = false
C.Humanoid.WalkSpeed = 16
for i=1,10 do
game.Workspace.CurrentCamera.FieldOfView = (90 - (i * 2)) -- This makes the players camera go closer to the player. Now the camera makes the walking effect. The camera view is now 70.
wait()
end
end
end
end)
put this inside a local script inside StarterGui (or StarterCharacterScripts if you prefer)
local Player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local deb = false
UIS.InputBegan:Connect(function(input, gpe)
if not gpe then
if input.KeyCode == Enum.KeyCode.LeftShift and not deb then
deb = true
Player.Character.Humanoid.WalkSpeed = 40
local newTween = TweenService:Create(workspace.CurrentCamera, TweenInfo.new(2), {
FieldOfView = 90,
})
newTween:Play()
wait(2) deb = false
end
end
end)
UIS.InputEnded:Connect(function(input, gpe)
if not gpe then
if input.KeyCode == Enum.KeyCode.LeftShift and not deb then
deb = true
Player.Character.Humanoid.WalkSpeed = 20
local newTween = TweenService:Create(workspace.CurrentCamera, TweenInfo.new(2), {
FieldOfView = 70,
})
newTween:Play()
wait(2) deb = false
end
end
end)