Animation not working pls help

local walkAnimation = npc2:WaitForChild("WalkAnim")
					local flowerAnim = npc2:WaitForChild("FlowerAnim")
					local walkTrack = npc2.Humanoid:LoadAnimation(walkAnimation);
					local flowerTrack = npc2.Humanoid:LoadAnimation(flowerAnim);
					walkTrack:Play();
					npc2.Humanoid.MoveToFinished:Wait(2)
					ChatService:Chat(npc2.Head, "you can edit this btw", "White")
					task.wait(2)
					ChatService:Chat(npc2.Head, "you can edit this btw", "White")
					task.wait(2)
					ChatService:Chat(npc2.Head, "you can edit this btw", "White")

					--npctype 40
					if npctype == "40" then
						task.wait(2)
						npc1.Humanoid:MoveTo(npc2Route.Position)
						walkTrack:Play()
						npc1.Humanoid.MoveToFinished:Wait(2)
						flowerTrack:Play()
					end

					task.wait(5)
					npc2.Humanoid:MoveTo(originalPos2.Position)
					walkTrack:Play()
					npc2.Humanoid.MoveToFinished:Wait(2)

LocalScript will only run when it is under a Player or ReplicatedFirst

copy the code from that animate script and change it to a server script

1 Like

the script is server side from serverscriptservice

ServerScriptService is probably the issue

put your animating script inside the NPC and change it up so it works properly

1 Like

the script in serverscriptservice is handling anything that trigger the npc to do a animation, so what i can do?

just code it in the NPC?

here’s some code i use in an npc:

local Dummy = script.Parent
local Humanoid = Dummy.Humanoid
local Tool = Dummy:FindFirstChildOfClass("Tool")
local Anim = Tool.Ready
local Anim2 = Dummy.WalkAnim


local Animator = Humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", Humanoid)


local Ready = Animator:LoadAnimation(Anim)
local Run =  Animator:LoadAnimation(Anim2)
print(Run.Priority)
Ready:Play()

Humanoid.Running:Connect(function()
	if Dummy.HumanoidRootPart.AssemblyLinearVelocity.Magnitude > 1 then
		Run:Play()	
	else
		Run:Stop()
	end
end)
function Attack()
	local totalChance = 0 
	for _,chance in pairs(AttackChances) do
		totalChance += chance
	end

	local rng = math.random(1, totalChance)

	for option, chance in pairs(AttackChances) do
		rng -= chance
		if rng <= 0 then
			if option == heavyattack then
				heavyattack:Play()
			elseif option == combo then
				combo:Play()
			end
			break
		end
	end
end

you just put a server script into the npc and code

not sure if using ServerScriptService is an issue but that’s just what i think it is

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.