What I’m trying to make in my module script is when the module is executed, it destroys the animate script within the players character (It also does other stuff but that’s not what I need help with). I’m pretty sure it does that but the animations keep playing. So I found out that you have to stop all of the animation tracks yourself by using GetPlayingAnimationTracks(). I used this in a for loop, which is what you’re supposed to do and it isn’t working. It’s showed inn the code below.
Tell me if I messed up anywhere or if I need to do something differently.
local module = {}
function module.Brawler(input)
for i,p in pairs(game.Players:GetPlayers()) do
local char = p.Character
local torso = char.Torso
local head = char.Head
local face = head.face
local human = char.Humanoid
local shirt = script.Template.Shirt:Clone()
local pants = script.Template.Pants:Clone()
if p and face and torso and char and human and head then
if input == p.Name then
char.Animate:Destroy()
for i,v in pairs(human:GetPlayingAnimationTracks()) do
if v and v:IsA("Animation") then
v:Stop()
print("Stopped")
end
end
script.Animate:Clone().Parent = char
updateCharacter(char)
face.Texture = script.Template.Head.face.Texture
human:RemoveAccessories()
local t = char:FindFirstChildWhichIsA("ShirtGraphic")
if t then
t:Destroy()
end
human:AddAccessory(script.Template["Autumn turns to Winter"]:Clone())
human:AddAccessory(script.Beard:Clone())
shirt.Parent = char
pants.Parent = char
for i,c in pairs(script:GetChildren()) do
if c:IsA("CharacterMesh") then
c:Clone().Parent = char
end
end
end
end
end
end
return module