I found it never mind. Local script?
The code that I use for pretty much every NPC affected (except game.Workspace.Bandit_Cinematic1 is replaced with script.Parent)
local Human = game.Workspace.Bandit_Cinematic1:WaitForChild("Person", 15)
local SwingAnimation0 = Human.Animator:LoadAnimation(script:FindFirstChild("IdleStand"))
local SwingAnimation1 = Human.Animator:LoadAnimation(script:FindFirstChild("Idle"))
local SwingAnimation2 = Human.Animator:LoadAnimation(script:FindFirstChild("Idle2"))
while true do
local animTracks = Human:GetPlayingAnimationTracks()
for _, animationTrack in ipairs(animTracks) do
animationTrack:Stop()
end
SwingAnimation1:Stop();
SwingAnimation2:Stop();
SwingAnimation0:Play();
local Chance = math.random(4,18)
wait(Chance)
SwingAnimation0:Stop();
SwingAnimation1:Stop();
SwingAnimation2:Play();
wait(4.4)
SwingAnimation1:Stop();
SwingAnimation2:Stop();
SwingAnimation0:Play();
local Chance2 = math.random(8, 16)
wait(Chance2)
SwingAnimation0:Stop();
SwingAnimation2:Stop();
SwingAnimation1:Play();
wait(3)
end
Yes, LocalScript, and Idle script in PlayerScripts
I even tried doing something as simple as using only 3 code lines (getting animator object, loading animation, playing animation), it still results in bug.
Very strange not gonna lie, but for some reason. The script perfectly worked on a server script, though that’s not a very good method for scaled up size
Wdym scaled up size? The default Rig model scale is set to default number 1. I’m using atm pretty much default parameters everywhere and the bug still happens.
I meant the server handling animations may cause lag if there are too many npcs
Yeah, but I get this issue on an empty baseplate, whether I’m using client side script or server side script, this issue still happens with both localscript or not.
Also it happens on mobile too, so it’s definitely not my PC fault.
Alright, now how does this happen? (im using other anims)
What animation ID are you using? It’s not one of Idle animations I’ve been testing.
They’re random animations I found for R15
I guess they work this time? But that doesn’t solve the problem why nearly every idle animation breaks. I’ve tried using Roblox animation IDs, tried resaving it as my own asset and using its ID, I even tried making a new custom idle animation from scratch it still breaks.
I will try one more “possible solution” to reupload these anims with Action priority.
Try to get every children of workspace.Ignore
at the start and play animation for every humanoid. The ChildAdded
isn’t working for me too.
Ok I found the issue (I THINK). When I first clone an NPC into the Workspace.Ignore
, it isn’t detected by the localscript. But cloning another NPC works (after a 2 second delay). My guess is that the player hasn’t been fully initialized when the NPC is cloned.
But I’ve tried cloning NPCs 5 mins later after player has entered game, the issue still happens. I also tried adding task.wait(3) at start of script when the NPC spawns, it still results in same issue.
for _, child in ipairs(game.Workspace.Ignore:GetChildren()) do
if child:FindFirstChild("Person") then
local Human = child:WaitForChild("Person", 15)
if Human and Human:FindFirstChild("Animator") then
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://118430473310618"
local SwingAnimation0 = Human.Animator:LoadAnimation(anim)
SwingAnimation0:Play()
while true do
local Chance = math.random(4, 18)
wait(Chance)
SwingAnimation0:Stop()
SwingAnimation0:Play()
end
else
warn("Animator not found in Person.")
end
end
end
This fixed it for me
Let me know if it fixes for you.
This doesn’t work, unless model is already placed in workspace Ignore folder. In this case such test ruins purpose of testing :Cloned() NPC animation bugs. But I’ll try to add a code line at start to make the code execute when a new child is added.