generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Why won't this simple tool work?

Previous Thread :: Next Thread 
david1234501 is not online. david1234501
Joined: 04 Oct 2008
Total Posts: 737
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
david1234501 is not online. david1234501
Joined: 04 Oct 2008
Total Posts: 737
03 Feb 2014 03:22 PM
b
Report Abuse
domorox17 is not online. 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
david1234501 is not online. david1234501
Joined: 04 Oct 2008
Total Posts: 737
03 Feb 2014 03:28 PM
It still didn't work.
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
03 Feb 2014 03:29 PM
Sorry, Tool.Equipped
Report Abuse
david1234501 is not online. david1234501
Joined: 04 Oct 2008
Total Posts: 737
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image