hello all, my run script works perfectly fine it’s that it will not continue playing when the player stops jumping.
Example
ik the source code is rlly messy
local uis = game:GetService("UserInputService")
local cameraShake = require(game.ReplicatedStorage.CameraShaker)
local vibrationPreset = cameraShake.Presets.Vibration
local TweenService = game:GetService("TweenService")
local run = TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.5), {FieldOfView = 75})
local walk = TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.5), {FieldOfView = 70})
local playersHumanoid = game.Players.LocalPlayer.Character.Humanoid
local newAnimation = Instance.new("Animation")
newAnimation.AnimationId = "rbxassetid://"..script:GetAttribute("AnimationID")
loadAnimation = playersHumanoid:LoadAnimation(newAnimation)
local runSpeed = 25
local walkSpeed = 16
local contextService = game:GetService("ContextActionService")
uis.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.LeftShift then
run:Play()
loadAnimation:Play()
playersHumanoid.WalkSpeed = runSpeed
end
end)
uis.InputEnded:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.LeftShift then
walk:Play()
loadAnimation:Stop()
playersHumanoid.WalkSpeed = walkSpeed
end
end)
playersHumanoid.Changed:Connect(function()
if playersHumanoid.Jump and loadAnimation.IsPlaying then
loadAnimation:Stop()
end
end)