I'm trying to change a enemy npc's position when the time is at 21 hours (which i've done), I used a for loop, and when it gets to humanoid, it errors out. Can someone come to my aid with some help? I will include the code below:
local lighting = game.Lighting
local monster = workspace.Monster
local monsterSpawn = workspace.monsterSpawn.Position
while true do
lighting:SetMinutesAfterMidnight(lighting:GetMinutesAfterMidnight() + 0.75) -- dont touch (well if u want u can)
wait(0.001) -- change to whatever you want
if lighting.ClockTime >= 21 then
local parts = monster:GetChildren()
for i, v in pairs(parts) do
v.Position = Vector3.new(monsterSpawn.X, monsterSpawn.Y, monsterSpawn.Z)
end
end
end
Thanks to anyone who helps :)

1 comment
Not all children are parts. Use if v:IsA("BasePart") then