|
| 03 Apr 2013 09:14 PM |
| How would I go about having all parts of a model becoming unanchored, then re-anchored again, and then reset to original position? |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 03 Apr 2013 09:15 PM |
for i,v in pairs(script.Parent:GetChildren()) do v.Anchored = false v.Anchored = true end
That's assuming you don't have parts inside of parts. |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
| |
|
UnAdmin
|
  |
| Joined: 10 Jul 2012 |
| Total Posts: 4706 |
|
|
| 03 Apr 2013 09:17 PM |
| You mean like unanchored for a time period and reset? |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 09:18 PM |
| Yeah... I want to make something fall and then go back up again. |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 03 Apr 2013 09:25 PM |
ModelClone = script.Parent:Clone()
TimeBeforePartsFall = 10 --Change to how long you want till the parts fall
TimeBeforeModelIsMovedBack = 10 --Change to how long you want till the model moves back
for NumberOfParts = 1,#script.Parent:GetChildren()
wait(TimeBeforePartsFall)
if script.Parent:GetChildren()[NumberOfParts].ClassName == "Part" then
script.Parent:GetChildren()[NumberOfParts].Anchored = false
end
wait(TimeBeforeModelIsMovedBack)
ModelClone.Parent = Workspace
script.Parent:Destroy()
end
Script goes in the model. |
|
|
| Report Abuse |
|
|
UnAdmin
|
  |
| Joined: 10 Jul 2012 |
| Total Posts: 4706 |
|
|
| 03 Apr 2013 09:26 PM |
| I assume you want it to kinda explode or fall apart without an explosion, right? And have a "round time" where the building is unanchored and have a "wait time" where the building is anchored. |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 03 Apr 2013 09:51 PM |
I'm sorry I messed up on my script.
ModelClone = script.Parent:Clone()
TimeBeforePartsFall = 10 --Change to how long you want till the parts fall
TimeBeforeModelIsMovedBack = 10 --Change to how long you want till the model moves back
for NumberOfParts = 1,#script.Parent:GetChildren() do
wait(TimeBeforePartsFall)
if script.Parent:GetChildren()[NumberOfParts].ClassName == "Part" then
script.Parent:GetChildren()[NumberOfParts].Anchored = false
end
end
wait(TimeBeforeModelIsMovedBack)
ModelClone.Parent = Workspace
script.Parent:Destroy() |
|
|
| Report Abuse |
|
|
UnAdmin
|
  |
| Joined: 10 Jul 2012 |
| Total Posts: 4706 |
|
|
| 03 Apr 2013 09:52 PM |
local waitTime = 10 --Seconds local roundTime = 60 --Seconds local model = game.Workspace["Model Name Here!"]
for i,v in pairs(model:GetChildren()) do --Don't worry about this part. It only makes sure everything is anchored if v:IsA("Part") then v.Anchored = true end end
while wait(waitTime) do--This will repeat infinitly. local newModel = model:Clone() for i,v in pairs(model:GetChildren()) do if v:IsA("Part") then v.Anchored = false end end model:BreakJoints() wait(roundTime) model:Destroy() model = newModel model.Parent = Workspace end
|
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 03 Apr 2013 09:53 PM |
Why did you add breakjoints? He didn't ask for that.
My script goes infinitly to. Without a while loop. |
|
|
| Report Abuse |
|
|
UnAdmin
|
  |
| Joined: 10 Jul 2012 |
| Total Posts: 4706 |
|
|
| 03 Apr 2013 09:56 PM |
| I fixed the breakjoints in a PM to him. |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 03 Apr 2013 10:00 PM |
If he had asked for it I would have added it.
He PM'd me and asked me to fix it as well. |
|
|
| Report Abuse |
|
|