generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Short Destroy Script

Previous Thread :: Next Thread 
Techante is not online. Techante
Joined: 17 Oct 2011
Total Posts: 2101
06 Apr 2015 09:26 AM
This is how it is set out

[Model]
----[TestScript]
----[Test]
---------[Part]
---------[Part]
---------[Part]
---------[Part]

So basically There is a Model, inside the model is a TestScript and a Model called "Test".
Inside the model there is 4 parts and here is the script(TestScript)

________________________________________________________________________
local Model = script.Parent.Test
local ModelChildren = Model:GetChildren()

for q = 1, #ModelChildren do
ModelChildren[q].Parent = workspace
script.Parent:Destroy()
end
________________________________________________________________________


Currently what it does is it only moves one part from model into workspace, it doesn't move all of the parts to workspace, and I can't understand why, so please can someone tell me what is wrong with the script.
Report Abuse
SummerEquinox is not online. SummerEquinox
Joined: 25 Jun 2013
Total Posts: 2088
06 Apr 2015 09:28 AM
Get to the test like this

local Model = game.Workspace.Model.Test
not Model = script.Parent.Test
Report Abuse
Techante is not online. Techante
Joined: 17 Oct 2011
Total Posts: 2101
06 Apr 2015 09:30 AM
That didn't work.
Report Abuse
SummerEquinox is not online. SummerEquinox
Joined: 25 Jun 2013
Total Posts: 2088
06 Apr 2015 09:32 AM
I never said it would fix it, that is fixing that piece of the script.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
06 Apr 2015 09:33 AM
Well looks to me as though it would move one part and then destroy the model making nothing else happen


~Commands? Commands. www.roblox.com/Admin-item?id=232183441
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
06 Apr 2015 09:36 AM
As soon as the first part is moved the parent model is destroyed, taking the script with it.
Report Abuse
Techante is not online. Techante
Joined: 17 Oct 2011
Total Posts: 2101
06 Apr 2015 11:59 AM
Thanks for explaining the problem to me(even though I already knew what it was), but my question was how do I fix the problem..
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
06 Apr 2015 12:02 PM
destroy the modeel after you move all the blocks
for q = 1, #ModelChildren do
ModelChildren[q].Parent = workspace
end

Destroy()
~Commands? Commands. www.roblox.com/Admin-item?id=232183441
Report Abuse
Techante is not online. Techante
Joined: 17 Oct 2011
Total Posts: 2101
06 Apr 2015 12:10 PM
I just fixed it, and yeh, I had to put the destroy outside the for function.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
06 Apr 2015 12:11 PM
loop*


~Commands? Commands. www.roblox.com/Admin-item?id=232183441
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image