Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a script.Parent.part to be moved to another Model?

Asked by 7 years ago

How do I make a script that can take script.Parent.Part & move it into another Model?

Model1 Model2

The Part need to be moved from Model1 to Model2 how can I do that.

Current Script:

script.Disabled = false

local part = script.Parent.Union

-- Else no Script for now.

2 answers

Log in to vote
0
Answered by 7 years ago

You need to understand two things.

--First of all, if the script is disabled, then this will not run:
script.Disabled = false
--And therefore, it will remain disabled.

--Second of all, to switch Parents, just assign it a new one!
local part = script.Parent.Union
local model2 = workspace -- switch workspace to the wanted Model2
part.Parent = model2
0
This one can be used for my thing with an extra dot. MineJulRBX 52 — 7y
Ad
Log in to vote
0
Answered by
Podnf 22
7 years ago
Edited 7 years ago

Wait, the script's parent is in a part? If that's true, do this:

script.Parent.Parent = workspace.Model2

Solved. Your part is now in Model2.

If you want a non-relative way, then do this:

workspace.Model1.Part.Parent = workspace.Model2

This should work.

Answer this question