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

How do I change a model's parent via script?

So I have a script that is supposed to make a folder's parent the workspace if the player count is less than 2. In the folder, there are 4 bots that follow the player and attack them. here's the script.

players = game.Players:GetChildren()
if #players >= 2 then
	game.ReplicatedStorage.Bots.Parent.new = workspace
end

the problem is that nothing actually happens. can someone please fix the script?

1 comment

0

Bots.Parent = game.Workspace

1 answer

✓ Accepted answer

You don't need the .new

game.ReplicatedStorage.Bots.Parent = game.Workspace

If you need to create a copy of the item, use :Clone() and set the parent of the copy:

game.ReplicatedStorage.Bots:Clone().Parent = game.Workspace

1 comment

1

Oh, thanks!

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