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

Cloning a model to workspace is not working?

I am making a clone script which isn't working and I think it is because it is a model, is there any way to clone a model? If this is not the case could you please tell me what is wrong with this script? Thanks!

My current script

local Enemies = script.Parent.Enemies

game:WaitForChild("Players").PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
	
	Enemies.Dark:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark1:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark2:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark3:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark4:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark5:Clone().Parent = game.Workspace.Enemies
	while true do
wait(1)
	if char.Humanoid.Health == 0 then
		Enemies.Dark:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark1:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark2:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark3:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark4:Clone().Parent = game.Workspace.Enemies
	Enemies.Dark5:Clone().Parent = game.Workspace.Enemies
	end
end
end)
end)



1 answer

✓ Accepted answer

First of all, try parenting your clones into Workspace instead of something within Workspace. Also, you might get a lot of them to spawn at once when doing "while true do" but you can resolve that later.

Also, instead of doing a ".Parent" thing for clones, just put it in between those brackets. It literally parents it to it.

So instead of this:

:Clone().Parent = ...

Do this:

:Clone(game.Workspace)

One last thing: make sure that you are doing this in a Script and not a LocalScript as this is a somewhat common issue.

If you have any questions or issues please contact me. ;)

6 comments

0

Thanks, I had no idea that was what the brackets were for

0

If this is the correct answer please accept it. I just would like to keep track of what I fixed or has been fixed (it helps others too).

0

I just tested it and it didn't work

0

What happens when you run it? Any errors?

0

I get no errors

0

Are you running this on a normal script? Also, did you make sure the script is either in ServerScriptService, Workspace, StarterCharacterScripts, or StarterPlayerScripts?

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