Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.