|
| 28 Dec 2014 04:18 PM |
Okay, so I have a model called Cannon, and I want every brick inside it to be unanchored, to which I've used the follow:
for i, v in pairs (game.Workspace.Cannon:GetChildren()) do v.Anchored = false
Problem is, it unanchores each brick at a time, making it a slow process. I haven't been able to find any help on the internet, which is why I made this post. Thanks in advance.
|
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 28 Dec 2014 04:23 PM |
Uhm, one brick at a time.. but the interval is like .03 seconds. Stop being greedy for fastnarse dis works fien pls
local model = game.Workspace.Model
function unAnchor(model) for i,v in pais(model:GetChildren()) do if v:IsA("BasePart") then v.Anchored = false end if #v:GetChildren() > 0 then unAnchor(v) end end end
unAnchor(model) |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 28 Dec 2014 04:28 PM |
local function property(o, p, v) pcall(function(o[p] = v end) for _, object in next, o:GetChildren() do property(object, p, v) end end
property(workspace.Model, "Anchored", false) |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 28 Dec 2014 04:31 PM |
| I shall nevar post again. 4k milestone. |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 28 Dec 2014 04:33 PM |
Typo fix
pcall(function(o[p] = v end)
Was meant to be
pcall(function() o[p] = v end) |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2014 04:36 PM |
| Well Goulstem, I shortned your script to make it work and thanks. Also, gratz on the milestone. |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 28 Dec 2014 04:37 PM |
Whats wrong with mine?
Plus mine can be used for more than 1 property
property(workspace, "Name", "Hello world!")
Would rename everything in workspace 'Hello world!' |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
| |
|
|
| 28 Dec 2014 04:40 PM |
| 128GB, nothing at all, just tried out the first thing that got posted. |
|
|
| Report Abuse |
|
|