Answer
Well, first, you can put in StarterPlayer considering it always updates your position even when the position is modified by a LocalScript. So something like this may work:
local uis = game:GetService("UserInputService")
local character = workspace:WaitForChild(script.Parent.Parent.Name)
local sprinting = false
local EasingSpeed = 3
local sprintFOV = 120
local defaultFOV = 70
local defaultRunSpeed = 16
local sprintRunSpeed = 32
local highJump = true
local defaultJumpPower = 50
local sprintJumpPower = 75
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
sprinting = true
end
end)
uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
sprinting = false
end
end)
while wait() do
if sprinting == true then
if workspace.CurrentCamera.FieldOfView < sprintFOV + 1 then
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + EasingSpeed
end
character.Humanoid.WalkSpeed = sprintRunSpeed
if highJump == true then
character.Humanoid.JumpPower = sprintJumpPower
end
elseif sprinting == false then
if workspace.CurrentCamera.FieldOfView > defaultFOV - 1 then
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView - EasingSpeed
end
character.Humanoid.WalkSpeed = defaultRunSpeed
character.Humanoid.JumpPower = defaultJumpPower
end
end
If you need some things explained, continue to the next part.
Explanation
So, if you look at the script, you can see many variables at the top. What these really mean is simple:
EasingSpeed = The amount of FOV (Field of View) it changes every tick when sprinting
sprintFOV = The FOV that is eased to when sprinting
defaultFOV = The default FOV (FOV when not sprinting)
defaultRunSpeed = The Humanoids WalkSpeed when not sprinting
sprintingRunSpeed = The Humanoids WalkSpeed when sprinting
highJump = whether or not the Humanoids JumpPower is affected by sprinting
defaultJumpPower = the Humanoids JumpPower when not sprinting
sprintingJumpPower = the Humanoids JumpPower when sprinting
Feel free to customize these how you wish!
flunkywhat, Game Dev