|
| 03 Feb 2014 02:53 PM |
I'm trying to make a tool that makes you invisible when you click, and visible again when you click again. Here is the coding: I have no idea why it isn't working.
Tool = script.Parent.Parent plr = script.Parent.Parent.Parent chk = script.Parent.Check
Tool.Activated:connect(function() if chk.Value == false then Tool.Enabled = false chk.Value = true local bParts = plr:GetChildren() for i, v in pairs(bParts) do if v:IsA("Part") then v.Transparency = 1 elseif v:IsA("Hat") then v:Remove() end end Tool.Enabled = true elseif chk.Value == true then Tool.Enabled = false chk.Value = false local bParts = plr:GetChildren() for i, v in pairs(bParts) do if v:IsA("Part") then v.Transparency = 0 end end end end) |
|
|
| Report Abuse |
|
|
| |
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 03 Feb 2014 03:23 PM |
I do not think activated is what you want. Try instead
script.Parent.Equipped:connect(function(mouse) mouse.Button1Click:connect(function() --rest of code here end) end) |
|
|
| Report Abuse |
|
|
| |
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
| |
|
|
| 03 Feb 2014 03:30 PM |
| Yeah, I know. It isn't the connection that is causing the problem. The output isn't saying anything. I think it has something to do with the :GetChildren() check. |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 03 Feb 2014 03:35 PM |
Ok, here is something off the top of my head.
tool = script.Parent active = false stuff = tool.Parent:GetChildren()
tool.Equipped:connect(function(mouse) mouse.Button1Click:connect(function() if not active then for i,v in pairs(stuff) do if v:IsA("BasePart") then v.Transparency = 1 elseif v:IsA("Hat") then v:remove() end end active = true elseif active then for i,v in pairs(stuff) do if v:IsA("BasePart") then v.Transparency = 0 elseif v:IsA("Hat") then v:remove() end end end end) end) |
|
|
| Report Abuse |
|
|