here is what I have so far
local NPC = game.Workspace.NPC
local function AnimationFunction()
if NPC:FindFirstChild("StatueAnimation") then
local animation = NPC:WaitForChild('StatueAnimation')
local humanoid = NPC:WaitForChild('Humanoid')
local StatueAnimation = humanoid:LoadAnimation(animation)
StatueAnimation:Play()
print("exampleanimation played")
elseif NPC:FindFirstChild("ExampleAnimation") then
local animation = NPC:WaitForChild('ExampleAnimation')
local humanoid = NPC:WaitForChild('Humanoid')
local ExampleAnimation = humanoid:LoadAnimation(animation)
ExampleAnimation:Play()
print("exampleanimation played")
else print("not working")
end
end
for k,n in pairs(game.Workspace:GetChildren()) do
if n.Name == "NPC" then
AnimationFunction()
end
end

1 comment
this did work, Thank you. And no, your code is very clean looking, much better than mine!