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

A Basic NPC 'Idle' Animation Script Help?

local char = script.Parent --the npc
local hum = char:WaitForChild("Humanoid") --the npc's humanoid
local animation1 = hum:LoadAnimation(script.Animation1) --finds the animation inside the script and loads it in the npc's humanoid
local animation2 = hum:LoadAnimation(script.Animation2)

if char and animation1 and animation2 then --this just checks if the npc exists
	while true do
	animation2:Play() --plays the animation
	wait(4.5)
	animation2:Stop() --stops the animation
	animation1:Play()
	wait(8)
	animation1:Stop()
	animation2:Play()
	wait(4.5)
	animation2:Stop()
	animation1:Play()
	wait(8)
	animation1:Stop()
	end
end

So, I'm trying to make this NPC's only purpose is to be an Idle player for my Custom Character GUI. In Studio, the script above works just fine, however, in online mode/server the figure just stands there with no animate being at all. All recommendatons/suggestions are welcome! Thank you, for your time.

Respectfully,

  • sparkevin

2 comments

0

Local scripts in NPCs don't work in a online server. If this script is a local script and is inside the NPCs character model, convert it to a server script and it should run fine in a online server.

0

@sickings It's not a Local script.

1 answer

You must make it Filtering Enabled compatible. Learn about remote events and remote functions here.

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