So I have a run function and a run animation, and one problem with it is that whenever the player stops running, the animation does not stop. (idk how to fix this)
Here’s the portion of the script:
["Run"] = function(isRunning)
local humanoid: Humanoid = char:WaitForChild("Humanoid")
local Tween = game:GetService("TweenService")
local camera: Camera = workspace.CurrentCamera
local event: RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild(" "):WaitForChild("RunEvent")
local info = TweenInfo.new(
.8,
Enum.EasingStyle.Bounce,
Enum.EasingDirection.Out,
0,
false,
0
)
local animator: Animator = humanoid:WaitForChild("Animator")
local animation = Instance.new("Animation")
animation.AnimationId = 'https://www.roblox.com/asset/?id=13060081719'
local run_track: AnimationTrack = animator:LoadAnimation(animation)
if isRunning then
run_track:Play()
local goals = {}
goals.FieldOfView = 90
local track = Tween:Create(camera, info, goals)
track:Play()
event:FireServer(isRunning, humanoid)
else
local goals2 = {}
goals2.FieldOfView = 70
local track = Tween:Create(camera, info, goals2)
track:Play()
event:FireServer(isRunning or false, humanoid)
run_track:Stop()
end
end,