game.ReplicatedStorage.FruitRemotes.GomuGomu.Pistol.OnServerEvent:Connect(function(player, hit, fruit) local pistolAnim = character:WaitForChild("Humanoid"):LoadAnimation(game.ReplicatedStorage.Animations.GomuGomu.PistolAnim) pistolAnim:Play() end) game.ReplicatedStorage.FruitRemotes.GomuGomu.PistolAttack.OnServerEvent:Connect(function(player, hit, fruit) local oldAnimation = character.Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.GomuGomu.PistolAnim) oldAnimation:Stop() end)
The code used to work, but now it doesn't. Could it possibly be a bug?
I am not an expert, but you could try first to set the Looped animation to false and then to stop. This could might work. Else you could try to check if the Remote Event/Function get even fired. Check it with
game.ReplicatedStorage.FruitRemotes.GomuGomu.Pistol.OnServerEvent:Connect(function(player, hit, fruit) local pistolAnim = character:WaitForChild("Humanoid"):LoadAnimation(game.ReplicatedStorage.Animations.GomuGomu.PistolAnim) pistolAnim:Play() end) game.ReplicatedStorage.FruitRemotes.GomuGomu.PistolAttack.OnServerEvent:Connect(function(player, hit, fruit) local oldAnimation = character.Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.GomuGomu.PistolAnim) print("TEST") oldAnimation:Stop() end)
I Hope I could helped you a bit infront :-)
Its because you are loading the animation again. you can fix it by making the animation variable a global variable.
game.ReplicatedStorage.FruitRemotes.GomuGomu.Pistol.OnServerEvent:Connect(function(player, hit, fruit) pistolAnim =character:WaitForChild("Humanoid"):LoadAnimation(game.ReplicatedStorage.Animations.GomuGomu.PistolAnim) pistolAnim:Play() end) game.ReplicatedStorage.FruitRemotes.GomuGomu.PistolAttack.OnServerEvent:Connect(function(player, hit, fruit) pistolAnim:Stop() end)