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

how to make a script that teleports all the same npcs in the workspace to me?

Example there are 20 Zombies, 10 Skeletons how can i make a script that teleports all 20 Zombies and 10 Skeletons to me, please provide a script and tell me what each line of script does please.

1 answer

✓ Accepted answer

Loop through workspace, check if its an npc and tp it to you

Use this:

local location = workspace -- modify to the npcs parent if needed
local player = game.Players.TARGETMODIFY

for i, v in pairs(location:GetChildren()) do
	if v:FindFirstChild("Humanoid") then
		v.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame
	end
end

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