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
 

Re: How to change an int from a script.

Previous Thread :: Next Thread 
SuperSmartYoshi is online. SuperSmartYoshi
Joined: 24 Mar 2012
Total Posts: 174
07 Jul 2017 12:09 PM
I'm trying to make a script that will toggle my gui and I can get it to hide the guis but not vice versa. The problem is that my int value clicks (script.parent.parent.clicks.value) wont change values. As you can see at the end of Die and Born it is supposed to change values except in practice it is always 0.

if script.Parent.Parent.Clicks.Value == 0 then
function die()
script.Parent.Parent.Visible.Visible = false
script.Parent.Parent.CamFix.Visible = false
script.Parent.Parent.TextButton.Visible = false
script.Parent.Parent.Clicks.Value = 1
wait()
end
end


script.Parent.MouseButton1Down:connect(die)

if script.Parent.Parent.Clicks.Value == 1 then
function born()
script.Parent.Parent.Visible.Visible = true
script.Parent.Parent.CamFix.Visible = true
script.Parent.Parent.TextButton.Visible = true
script.Parent.Parent.Clicks.Value = 0
wait()
end
end

script.Parent.MouseButton1Down:connect(born)
Report Abuse
CelluloidCats is not online. CelluloidCats
Joined: 11 Aug 2015
Total Posts: 841
07 Jul 2017 12:10 PM
wat

your if statements are outside the functions. wat.



... wat.
Report Abuse
Thedagz is not online. Thedagz
Joined: 10 Mar 2012
Total Posts: 798
07 Jul 2017 12:11 PM
^
Report Abuse
SuperSmartYoshi is online. SuperSmartYoshi
Joined: 24 Mar 2012
Total Posts: 174
07 Jul 2017 12:12 PM
That was a copy pasting error, still doesnt work.
Report Abuse
CelluloidCats is not online. CelluloidCats
Joined: 11 Aug 2015
Total Posts: 841
07 Jul 2017 12:15 PM
you ... wat...
repaste the code pls
Report Abuse
SuperSmartYoshi is online. SuperSmartYoshi
Joined: 24 Mar 2012
Total Posts: 174
07 Jul 2017 12:15 PM
fixed it, locking the post now! Thanks

function die()
if script.Parent.Parent.Clicks.Value == 0 then
script.Parent.Parent.Visible.Visible = false
script.Parent.Parent.CamFix.Visible = false
script.Parent.Parent.TextButton.Visible = false
script.Parent.Parent.Clicks.Value = 1
wait()
elseif script.Parent.Parent.Clicks.Value == 1 then
script.Parent.Parent.Visible.Visible = true
script.Parent.Parent.CamFix.Visible = true
script.Parent.Parent.TextButton.Visible = true
script.Parent.Parent.Clicks.Value = 0
wait()
end
end

script.Parent.MouseButton1Down:connect(die)
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
07 Jul 2017 12:16 PM
you can't lock the post haha
Report Abuse
SuperSmartYoshi is online. SuperSmartYoshi
Joined: 24 Mar 2012
Total Posts: 174
07 Jul 2017 12:18 PM
But I locked my reply :P
Report Abuse
CelluloidCats is not online. CelluloidCats
Joined: 11 Aug 2015
Total Posts: 841
07 Jul 2017 12:18 PM
You probably won't look at this post again but you could do this instead.
But this would require leParent.Clicks to be a BoolValue instead of an IntValue

function die()
local leParent = script.Parent.Parent
leParent.Visible.Visible = not leParent.Visible.Visible
leParent.CamFix.Visible = not leParent.CameFix.Visible
leParent.TextButton.Visible = not leParent.TextButton.Visible
leParent.Clicks.Value = leParent.Clicks.Value
wait()
end
Report Abuse
CelluloidCats is not online. CelluloidCats
Joined: 11 Aug 2015
Total Posts: 841
07 Jul 2017 12:18 PM
typo on line 4
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