Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my animation on my npc work only in studio but not in game?

Asked by 8 years ago

i know this question has been asked alot but i never seen an answer to this question. is it do i need to script it in a certain way or something?

please help

local humanoid = script.Parent:WaitForChild('Humanoid')
local idleAnim = game.ReplicatedStorage:WaitForChild'Animations':WaitForChild'Misc':WaitForChild'Idle'
if humanoid and idleAnim then
    local playIdleAnim = humanoid:LoadAnimation(idleAnim)
    playIdleAnim:Play()
end

1 answer

Log in to vote
0
Answered by 8 years ago
function PlayAnim()
local Humanoid = script.Parent:FindFirstChild("Humanoid")
local IdleAnim = game.ReplicatedStorage:WaitForChild("Animations"):WaitForChild("Misc"):FindFirstChild("IdleAnim")
--Don't know how you named it sincei can't see it in your script.
if Humanoid and IdleAnim then
local playIdleAnim = Humanoid:LoadAnimation(IdleAnim)
playIdleAnim:Play()
print("Played")
end

end

PlayAnim() --This should work.

Hope it helps!

Ad

Answer this question