How can I make a UI that deletes something in the player when clicked?

Hello. I’m making a game where you choose a character with abilities to fight against other players, and I’m having a bit of trouble adding the custom animations to my character, but I figured out what it was. When the player clicks the button that turns them into the character, the default animation in the character is still there. I have a bit of an idea of what I should do, but I’m a bit confused as to how I can execute it. Does anyone have any idea as to how I can delete the default animation from under the character? Any help would be greatly appreciated!

1 Like

What’s the animation that remains there, is it caused to play by the regular roblox “Animate” script?

Yes. The two animations sort of collide and make the players animations a weird mess.

So there are two “Animate” scripts?

Yes, but I renamed the Animate script that I want the player to have when they click the button into the characters name plus animation so that they wouldn’t get confused with each other and delete both when then player clicks the button.

just make a script where u disable the scriptAnimation you dont want
(use button.activated or any trigger to do it)

If you don’t want to delete the original script you could replace the values inside it (“children” values),
but the changes won’t apply instantly

Ok, that would probably work, thanks!

you could just cnp the animate script and put your own custom animations inside
then just put it in startercharacterscripts and it will cancel out the default animations

1 Like

or
local button = --buttonpath–

button.Activated:Connect(function(plrwhoactivatedit)
game:GetService("Debris):AddItem(plrwhoactivatedit:FindFirstChild({{{Animation}}},true))
end)