abaw7
|
  |
| Joined: 23 Oct 2009 |
| Total Posts: 745 |
|
|
| 22 Jul 2012 01:16 AM |
Ok so now when i sit in a seat that has this script (1) in it, My hats won't disapear it is probably just a simple mistake but i'm tired and haven't been able to figure it out.
(1):
function scan(p) local parts = {} for _,v in pairs(p:GetChildren()) do if (v:IsA("BasePart")) then table.insert(parts,v) end if (v.ClassName == "Hat") then -- Fixing a bug scan(v) end scan(v) end return parts end
script.Parent.ChildAdded:connect(function(obj) if ((not obj:IsA("Weld")) or (obj.Name ~= "SeatWeld")) then return end local p = game.Players:GetPlayerFromCharacter(obj.Part1.Parent) for i,v in pairs(scan(p.Character)) do v.Transparency = 1 end end)
script.Parent.DescendantRemoving:connect(function(obj) if ((not obj:IsA("Weld")) or (obj.Name ~= "SeatWeld")) then return end local p = game.Players:GetPlayerFromCharacter(obj.Part1.Parent) for i,v in pairs(scan(p.Character)) do v.Transparency = 0 end end)
|
|
|
| Report Abuse |
|
|
|
| 22 Jul 2012 01:18 AM |
| Check if it's a Hat then do hat.Handle.Transparency=1 |
|
|
| Report Abuse |
|
|
abaw7
|
  |
| Joined: 23 Oct 2009 |
| Total Posts: 745 |
|
|
| 22 Jul 2012 01:21 AM |
| "Handle" Is a Basepart. The Scan function scans the character when they enter put the base parts into a table and returns the table. Then the added methods use this table to change the transparency. It works for all the parts in the character, But hats. I'm trying to figure out how to make it work for hats as well. |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2012 01:24 AM |
| Honestly, the way You're doing this is alittle over-complicated. |
|
|
| Report Abuse |
|
|
abaw7
|
  |
| Joined: 23 Oct 2009 |
| Total Posts: 745 |
|
|
| 22 Jul 2012 01:27 AM |
| It needs to account for all hats possible and if you feel like indexing all the hats in roblox be my guest but this way is actually easier. |
|
|
| Report Abuse |
|
|
abaw7
|
  |
| Joined: 23 Oct 2009 |
| Total Posts: 745 |
|
| |
|
abaw7
|
  |
| Joined: 23 Oct 2009 |
| Total Posts: 745 |
|
| |
|