I am creating a gun system and there is a bug where when a player moves the animation stops.
Unfortunately I believe that my video is too large to upload, so I can’t show one.
Here is some code in a script inside the tool itself
local tool = script.Parent.Parent.Parent
local player
local getName = script.Parent.Parent:WaitForChild("Remotes"):WaitForChild("getName")
getName.OnServerEvent:Connect(function(playerInstance)
player = playerInstance
end)
tool.Equipped:Connect(function()
local character = player.Character or player.Character:Wait()
local hum = character:WaitForChild("Humanoid")
local Animator = hum:WaitForChild("Animator")
local holdAnimation = Instance.new("Animation")
holdAnimation.AnimationId = "rbxassetid://6977809658"
local holdAnimationTrack = Animator:LoadAnimation(holdAnimation)
print("Animation Loaded")
holdAnimationTrack.Priority = Enum.AnimationPriority.Action
holdAnimationTrack.Looped = true
holdAnimationTrack:Play()
end)