local Waiter = WaiterFolder.Waiter
local Part1 = MovementParts.Part1
local Part2 = MovementParts.Part2
local Part3 = MovementParts.Part3
local Part4 = MovementParts.Part4
local Part5 = MovementParts.Part5
local Humanoid = Waiter:FindFirstChild("Humanoid")
local DayAnimation = Waiter.DayAnimation
local NightAnimation = Waiter.NightAnimation
local DayAnim = Humanoid:LoadAnimation(DayAnimation)
local NightAnim = Humanoid:LoadAnimation(NightAnimation)
local Values = workspace.Values
local IsDayValue = Values.IsDay
local NPCSCanWalkValue = Values.NPCSCanWalk
function DayWalking()
while IsDayValue.Value == true do
local randomPart = math.random(1, 5)
wait(0.5)
if randomPart == 1 then
DayAnim:Play()
Humanoid:MoveTo(Part1.Position)
Humanoid.MoveToFinished:Wait()
DayAnim:Stop()
end
if randomPart == 2 then
DayAnim:Play()
Humanoid:MoveTo(Part2.Position)
Humanoid.MoveToFinished:Wait()
end
if randomPart == 3 then
DayAnim:Play()
Humanoid:MoveTo(Part3.Position)
Humanoid.MoveToFinished:Wait()
end
if randomPart == 4 then
DayAnim:Play()
Humanoid:MoveTo(Part4.Position)
Humanoid.MoveToFinished:Wait()
end
if randomPart == 5 then
DayAnim:Play()
Humanoid:MoveTo(Part5.Position)
Humanoid.MoveToFinished:Wait()
DayAnim:Stop()
end
end
end
function NightWalking()
while IsDayValue.Value == false do
local randomPart = math.random(1, 5)
wait(0.5)
if randomPart == 1 then
DayAnim:Play()
Humanoid:MoveTo(Part1.Position)
Humanoid.MoveToFinished:Wait()
DayAnim:Stop()
end
if randomPart == 2 then
DayAnim:Play()
Humanoid:MoveTo(Part2.Position)
Humanoid.MoveToFinished:Wait()
end
if randomPart == 3 then
DayAnim:Play()
Humanoid:MoveTo(Part3.Position)
Humanoid.MoveToFinished:Wait()
end
if randomPart == 4 then
DayAnim:Play()
Humanoid:MoveTo(Part4.Position)
Humanoid.MoveToFinished:Wait()
end
if randomPart == 5 then
DayAnim:Play()
Humanoid:MoveTo(Part5.Position)
Humanoid.MoveToFinished:Wait()
DayAnim:Stop()
end
end
end
StartNPCSEvent.Event:Connect(function()
while NPCSCanWalkValue.Value == true do
wait()
if IsDayValue.Value == true then
DayWalking()
end
if IsDayValue.Value == false then
NightWalking()
end
end
end)
It’s a little long, but in the DayWalking/NightWalking
functions where it says DayAnim:Play()
the animation doesn’t play. There are no errors in the script, and the npc moves just without an animation. How do I make the animation play?
If you need more info just ask!
Any help is appreciated!