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
 

Re: Please help!

Previous Thread :: Next Thread 
InfinityRacer is not online. InfinityRacer
Joined: 25 Oct 2013
Total Posts: 51
27 Dec 2013 05:25 AM
I made a script which is supposed to change the transparency of the brick when the brick is clicked this is what I have so far but it won't work, please edit it if you know what the right script would be!

function OnClick(mouse)
if script.Parent.Transparency = 0 then
(OnClick) script.Parent.Transparency = 1
else if script.Parent.Transparency = 1 then
(OnClick) script.Parent.Transparency = 0
end
end

script.Parent.ClickDetector.MouseClick:connect(OnClick)
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
27 Dec 2013 05:30 AM
function OnClick(mouse)
if script.Parent.Transparency == 0 then -- Should be two equal signs since it's a statement
script.Parent.Transparency = 1
else if script.Parent.Transparency == 1 then --Same here
script.Parent.Transparency = 0
end
end

script.Parent.ClickDetector.MouseClick:connect(OnClick)
Report Abuse
InfinityRacer is not online. InfinityRacer
Joined: 25 Oct 2013
Total Posts: 51
27 Dec 2013 05:43 AM
No change but if I do this it makes it invisible but then I want it to be able to put it back by clicking again:

function OnClicked(playerWhoClicked)
script.Parent.Transparency = 1
end

script.Parent.ClickDetector.MouseClick:connect(OnClicked)
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
27 Dec 2013 05:46 AM
clicked = false

script.Parent.ClickDetector.MouseClick:connect(function()
local part = script.Parent
if part.Transparency == 0 and clicked == false then
part.Transparency = 1
clicked = true
elseif part.Transparency == 1 and clicked == true then
part.Transparency = 0
clicked = false
end
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
27 Dec 2013 05:47 AM
clicked = false

script.Parent.ClickDetector.MouseClick:connect(function()
local part = script.Parent
if part.Transparency == 0 and clicked == false then
part.Transparency = 1
clicked = true
elseif part.Transparency == 1 and clicked == true then
part.Transparency = 0
clicked = false
end
end)

Forgot to add another end woops.
Report Abuse
InfinityRacer is not online. InfinityRacer
Joined: 25 Oct 2013
Total Posts: 51
27 Dec 2013 08:57 AM
Still no change :/
Report Abuse
YodaimeKing is not online. YodaimeKing
Joined: 01 Nov 2009
Total Posts: 3961
27 Dec 2013 09:04 AM
function OnClick(mouse)
script.Parent.Transparency = 0
elseif script.Parent.Transparency == 0 then
script.Parent.Transparency = 1
end-- May or may not need this end... Not sure with elseif statements..
script.Parent.ClickDetector.MouseClick:connect(OnClick)
Report Abuse
YodaimeKing is not online. YodaimeKing
Joined: 01 Nov 2009
Total Posts: 3961
27 Dec 2013 09:05 AM
Nvm, fixed.

function OnClick(mouse)
script.Parent.Transparency = 0
elseif script.Parent.Transparency == 0 then
script.Parent.Transparency = 1
end
end
script.Parent.ClickDetector.MouseClick:connect(OnClick)
Report Abuse
InfinityRacer is not online. InfinityRacer
Joined: 25 Oct 2013
Total Posts: 51
27 Dec 2013 09:37 AM
Still not working...
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
27 Dec 2013 09:39 AM
function OnClick(mouse)
if script.Parent.Transparency == 1 then
script.Parent.Transparency = 0
elseif script.Parent.Transparency == 0 then
script.Parent.Transparency = 1
end
end

script.Parent.ClickDetector.MouseClick:connect(OnClick)
Report Abuse
InfinityRacer is not online. InfinityRacer
Joined: 25 Oct 2013
Total Posts: 51
27 Dec 2013 09:49 AM
Got it anyways:

function OnClicked(playerWhoClicked)
if script.Parent.Transparency == 0 then
script.Parent.Transparency = 1
elseif script.Parent.Transparency == 1 then
script.Parent.Transparency = 0
end
end

script.Parent.ClickDetector.MouseClick:connect(OnClicked)
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
27 Dec 2013 09:49 AM
Ahh.. that's the same as what I gave you, except you renamed some variables :P
Report Abuse
InfinityRacer is not online. InfinityRacer
Joined: 25 Oct 2013
Total Posts: 51
27 Dec 2013 09:56 AM
You posted it the same time I made the script a model so I didn't copy yours...
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
27 Dec 2013 10:00 AM
That timing xD
Report Abuse
InfinityRacer is not online. InfinityRacer
Joined: 25 Oct 2013
Total Posts: 51
27 Dec 2013 10:00 AM
Lol
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