I want to let my custom Idle animation stop playing when my attack animation is playing. (I changed my custom Idle animation by going to Roblox’s animate script manually). I have tried to search for solutions on youtube, scriptinghelpers, devforum, etc., but didn’t get anything sadly. One of the solutions was AnimationPriority but that didn’t work as well.
Script:
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
while char.Parent == nil do
char.AncestryChanged:wait()
end
local animation = Instance.new("Animation")
local hum = char:WaitForChild("Humanoid")
animation.AnimationId = "http://www.roblox.com/asset/?id=7788468950"
track.Prioriy = Enum.AnimationPriority.Action -- one of the solutions that didn't work
track = hum:LoadAnimation(animation)
end)
game.ReplicatedStorage.Attack.OnServerEvent:Connect(function(plr,pos)
track:Play() --animation plays but it overrides my custom idle animation
end)
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
while char.Parent == nil do
char.AncestryChanged:wait()
end
local animation = Instance.new("Animation")
local hum = char:WaitForChild("Humanoid")
animation.AnimationId = "http://www.roblox.com/asset/?id=7788468950"
track.Prioriy = Enum.AnimationPriority.Action --One of the solutions that didn't work
track = hum:LoadAnimation(animation)
game.ReplicatedStorage.Attack.OnServerEvent:Connect(function(plr,pos)
track:Play() --- whene you place it out the function script it dont know what track mean
end)
end)
I changed it to the animation, but my Idle animation is completely gone because I have changed it manually inside Roblox’s Animate script. I want my animation just to play for a few seconds, then return to my original custom Idle animation. Thanks for the help, though.
Tried this. I also used print(track) to know which animations are going to be stopped, but sadly it just stops animations that aren’t in Roblox’s default animations such as Idle, Running, Walking, etc.
Thanks for commenting, but I want to play the animation while the player is standing. It played the animation, but that isn’t the problem. The problem is that the animation plays while the Idle animation is playing too at the same time.