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 » Scripters
Home Search
 

Why won't this script work?

Previous Thread :: Next Thread 
Agent_DiNozzo is not online. Agent_DiNozzo
Joined: 09 Jul 2016
Total Posts: 1801
01 Oct 2016 08:49 AM
I'm a noob to scripting and I'm having my first goes. I'm trying to make a part (named PartG) change transparency when clicked (With a clickdetector named ClickG)

Here's the script:
PartG = script.Parent

function turnGhostly()
if PartG.Transparency == 1 then
PartG.Transparency = 0
else
PartG.Transparency = 1
end


PartG.ClickG.MouseClick:connect (turnGhostly)

What is incorrect? I would be glad if you told me!
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
01 Oct 2016 08:51 AM
you are missing an "end"

the script analysis window as well as the output window would have caught this syntax error

please use them next time
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
01 Oct 2016 08:53 AM
also, you might want to do something like

if PartG.Transparency >= 0.99 then



just to account for rounding issues
Report Abuse
Agent_DiNozzo is not online. Agent_DiNozzo
Joined: 09 Jul 2016
Total Posts: 1801
01 Oct 2016 08:53 AM
@Agg
Thank you. I opened the Output and fixed the problem. As I said, I'm new to this stuff. But it works now! I'll experiment with changing brick colors next.
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
01 Oct 2016 08:55 AM
Can't really see what's wrong, but this is what I would usually do:

script.Parent.ClickDetector.MouseClick:connect(function()
if script.Parent.Transparency == 1 then
script.Parent.Transparency = 0
else
script.Parent.Transparency = 1
end
end

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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