Can someone tell me how to? im trying to make a scary obby
Insert your own NPC model and use it in the script. Adjust the spawning and despawning as needed.
-- Create the NPC local npc = Instance.new("Model") npc.Name = "Scary Gorilla" npc.Parent = game.Workspace -- Set the initial position of the NPC local initialPosition = Vector3.new(0, 0, 0) npc.PrimaryPart.Position = initialPosition -- Create a humanoid for the NPC local humanoid = Instance.new("Humanoid") humanoid.Parent = npc -- Spawn the NPC after a delay wait(5) npc:SetPrimaryPartCFrame(initialPosition) -- Make the NPC walk towards players while true do task.wait() local closestPlayer = game.Players:GetClosestPlayer(npc.PrimaryPart.Position) if closestPlayer then -- Make the NPC's humanoid walk towards the player's character humanoid:MoveTo(closestPlayer.Character.PrimaryPart.Position) -- Despawn the NPC after a delay wait(10) npc:Destroy() end end