Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
|
| 18 Oct 2013 09:46 AM |
for i,r in pairs(script.Parent:GetChildren()) do if r:IsA("Part") or r:IsA("Seat") or r:IsA("VehicleSeat") or r:IsA("WedgePart") then wait(5) r.Anchored = false end end
Hello scripters. I've got problem with :IsA. When I add it to my game, it unAnchor's Parts only. Seats, VehicleSeats and Wedges are being Anchored. Do you have any idea how to fix it? |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 18 Oct 2013 09:51 AM |
Try this:
stuff = {"Part", "Seat", "VehicleSeat", "WedgePart"} for i,r in pairs (script.Parent:GetChildren()) do for i,s in pairs (stuff) do if r.Name == s then r.Anchored = false end end end |
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
|
| 18 Oct 2013 10:00 AM |
| Its still unAnchoring Parts only. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 18 Oct 2013 10:05 AM |
Can't you simply do
if bla:IsA("BasePart") then
? |
|
|
| Report Abuse |
|
|
spikey490
|
  |
| Joined: 06 Oct 2008 |
| Total Posts: 229 |
|
|
| 18 Oct 2013 10:06 AM |
| It should unAnchor all of them, the problem is it waits five seconds for each one before it un-anchors the next part/seat whatever. |
|
|
| Report Abuse |
|
|
|
| 18 Oct 2013 10:31 AM |
Do what zars said, and use BasePart. Using the base classes for IsA is extremely useful.
And to fix your issue, either move the 'wait' outside of that loop, or delete it altogether. |
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
|
| 18 Oct 2013 11:24 AM |
| Okay, thank you all. It works properly now! |
|
|
| Report Abuse |
|
|