|
| 03 Nov 2016 06:27 AM |
Hello felow Robloxians!
I need a huge favor. Im working on a game and part of it includes that once you touch a certain part the model its in falls apart (unancors). I am able to make it so that it unancors each part seperatly but I need a script that would unancor any model, on the same principal as I sad before (once a certain brick is touched the model its in falls apart). I would be eternaly gratfull to anyone that could provide me with sutch a script.
Thank you in andvance! |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 08:51 AM |
Pretty sure this would work, at school so haven't tested it :P
local model = game.Workspace.Model local part = model:GetChildren() part.Touched:connect(function(p) if p.Parent and p.Parent.Humanoid then for i = 1,#part do part[i].Anchored = false wait() end end end) |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Nov 2016 12:02 PM |
Either im doiung it wrong or it wont work. Probably the first one. Here the the original script im using to break the model.
local p = script.Parent.Parent
function onTouched(hit) wait(.5) p.W1.Anchored = false p.W2.Anchored = false p.W3.Anchored = false p.W4.Anchored = false p.W5.Anchored = false p.W6.Anchored = false p.W7.Anchored = false p.W8.Anchored = false p.P1.Anchored = false p.P2.Anchored = false p.P3.Anchored = false p.P4.Anchored = false p.P5.Anchored = false end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 12:41 PM |
local function unAnchor(b) script.Parent.Parent = b for _,v in pairs(b:GetChildren(_))do if v:IsA("Part") then v.Anchored = false end end
return unAnchor end
script.Parent.Touched:connect(function() local runFunction = unAnchor(script.Parent.Parent) end)
Damn I can't believe I came up with this, I only been scripting close to 3 weeks :p
Anyways, you got a folder with a bunch of parts in it. Put this script in one of the parts inside that folder. The part that has the script in it will be the part to be touched. Everything inside the folder if IsA("Part") will unanchor. Or at least it should, it worked for me in studio.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Nov 2016 02:26 PM |
@synzoxre13
The block unancor but the wedges stay ancored |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 02:36 PM |
| oh and another problem with this script, the part in witch the script is in disapears. Its like it gets removed and therfore it cant restore back to normal. |
|
|
| Report Abuse |
|
|