When scripting my own bow for a game, I found a problem:
After the player shot, the animation isn’t playing for him, but it is still playing looped on the server and for other clients too.
Here’s the gif from the client: https://gyazo.com/ab1d20ecf7e89149bbd534cad38c9363
And the gif from the server: https://gyazo.com/4272e16bdaddc5dc573aa464a380d4c5
Script for animations:
tool.Equipped:Connect(function()
equipped = true
end)
tool.Activated:Connect(function()
if aiming == false and debounce == false then
debounce = true
pull:Play()
aiming = true
anaim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(aimanim)
anaim:Play()
anaim.Looped = false
anaim.KeyframeReached:connect(function(keyframeName)
if keyframeName == "Pause" then
anaim:AdjustSpeed(0)
debounce = false
end
end)
elseif aiming == true and debounce == false then
debounce = true
aiming = false
anaim:Stop()
anshoot = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animshoot)
event:FireServer(mouse, character, mouse.hit.p, mouse.UnitRay.Direction, player.Name)
anshoot.Looped = false
anshoot:Play()
wait(2)
debounce = false
end
end)
tool.Unequipped:Connect(function()
equipped = false
aiming = false
if anaim.IsPlaying == true then
anaim:Stop()
end
if anshoot.IsPlaying == true then
anshoot:Stop()
end
end)