I’ve been trying for weeks now to change the walking/idle animation, but nothing i do will work. i already tried trying to change the animate script, changing the AnimationId of RunAnim and Idle, and i even tried deleting the animations from the animate script and replacing them with the desired animations, but the game keeps playing the animations that don’t even exist anymore somehow. i don’t know if this is a glitch or something, but if anyone has any idea on how i can change the default animations with code during game runtime, it would really help me =)
The code i’m currently using:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local laserOff = ReplicatedStorage:WaitForChild("LaserOff")
local laserOn = ReplicatedStorage:WaitForChild("LaserOn")
local laserOffAnims = game:GetService("ServerStorage").Animations.LaserOff
local laserOnAnims = game:GetService("ServerStorage").Animations.LaserOn
laserOff.OnServerEvent:Connect(function(player)
print "LaserOff fired"
local char = player.Character or player.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid")
local animate = char:WaitForChild("Animate")
if animate then
print "animate"
end
for _, stuff in pairs(animate:GetChildren()) do
print("a")
stuff:Destroy()
end
for _, stuff in pairs(laserOffAnims:GetChildren()) do
local newStuff = stuff:Clone()
newStuff.Parent = animate
end
end)
laserOn.OnServerEvent:Connect(function(player)
print "LaserOn fired"
local char = player.Character or player.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid")
local animate = char:WaitForChild("Animate")
if animate then
print "animate"
end
for _, stuff in pairs(animate:GetChildren()) do
print("a")
stuff:Destroy()
end
for _, stuff in pairs(laserOnAnims:GetChildren()) do
local newStuff = stuff:Clone()
newStuff.Parent = animate
end
end)
btw I’ve tried debugging and the code works perfectly fine, the problem is just that even after the animations are deleted from the game, they still play.