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

How do I Clone and move a model?

In the event that the alarms go off, SD Assault Units are cloned and moved from game.ReplicatedStorage.Soldiers to workspace.NPCs. The script isn't working. Here's the script:

while true do
    local original = game.ReplicatedStorage.Soldiers.SDSoldier1
    local copy = original:Clone()
    copy.Parent = workspace.NPCs
    wait(10)
end

What's gone wrong? I would appreciate some help! Thanks!

8 comments

0

"while true do" oh no

0

So how do you detect the alarms going off? Do you even have a script for that?

0

Yes. a Script will detect whether the alarms go off and then if they have, this script will enable.

0

try using SetPrimaryPartCFrame to move the clones somewhere on the workspace that you can see, its possible the script is putting them at some location super far from the origin.

0

No. They are set to be parented in the NPCs folder, and nothing is there. Output isn't saying anything

0

You can use the MoveTo() feature which allows you to move models. This isn’t a solution just saying for when you want to move it lol.

0

Try capitalizing workspace. Sometimes it freaks out when I don’t lol.

0

"workspace" is a global variable for "game.Workspace".

1 answer

So, when I tested the script that you had, the parts that I had were duplicating into the folder, so if they do not show up where they are suppose to, change the CFrame of the root part in the model, and to make sure they don't spawn in the same area. The script I had(was the same as yours) if you wanted

while true do
    local original = game.ReplicatedStorage.Soldiers.SDSoldier1
    local copy = original:Clone()
    copy.Parent = workspace.NPCs
    wait(10)
end

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