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
 

Anyone know why this doesn't work?

Previous Thread :: Next Thread 
xxxtentaci_on is not online. xxxtentaci_on
Joined: 08 Jan 2012
Total Posts: 1767
12 Apr 2017 11:17 PM
local IsOpen = script.Parent.IsOpen
local ArtistList = script.Parent.ArtistList
local Button = script.Parent

function onClick()
IsOpen = false
if IsOpen == false then
ArtistList.Position = UDim2.new(ArtistList.Position.X.Scale, ArtistList.Position.X.Offset, ArtistList.Position.Y.Scale, ArtistList.Position.Y.Offset + 1000)
IsOpen = true
end
if IsOpen == true then
ArtistList.Position = UDim2.new(ArtistList.Position.X.Scale, ArtistList.Position.X.Offset, ArtistList.Position.Y.Scale, ArtistList.Position.Y.Offset - 1000)
IsOpen = false
end
end
Button.MouseButton1Down:connect(onClick)

Btw "IsOpen" is a bool value


Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
12 Apr 2017 11:21 PM
local IsOpen = script.Parent.IsOpen.Value
Report Abuse
xxxtentaci_on is not online. xxxtentaci_on
Joined: 08 Jan 2012
Total Posts: 1767
12 Apr 2017 11:22 PM
Thx ill try that


Report Abuse
xxxtentaci_on is not online. xxxtentaci_on
Joined: 08 Jan 2012
Total Posts: 1767
12 Apr 2017 11:23 PM
There is still something not working ;-;


Report Abuse
Dorandir is not online. Dorandir
Joined: 06 Aug 2016
Total Posts: 844
13 Apr 2017 12:34 AM
Keep
local IsOpen = script.Parent.IsOpen
as
local IsOpen = script.Parent.IsOpen

but whenver u call IsOpen make it IsOpen.Value
Do this with all Values
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
13 Apr 2017 09:48 AM
Button.MouseButton1Down:Connect(function()

if (IsOpen.Value) then -- If open is true
ArtistList.Position = UDim2.new(ArtistList.Position.X.Scale, ArtistList.Position.X.Offset, ArtistList.Position.Y.Scale, ArtistList.Position.Y.Offset + 1000)
else -- If false
ArtistList.Position = UDim2.new(ArtistList.Position.X.Scale, ArtistList.Position.X.Offset, ArtistList.Position.Y.Scale, ArtistList.Position.Y.Offset - 1000)
end

IsOpen.Value = not IsOpen.Value -- switch

end)
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
13 Apr 2017 09:51 AM
I think the problem was that you set IsOpen to false at the beginning of the function. Then if you follow the logic, it will always end up "closing" the GUI.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
13 Apr 2017 09:54 AM
I am an idiot. You don't even need to mess with positions. Just use Visible

Button.MouseButton1Down:Connect(function()

IsOpen.Value = not IsOpen.Value
ArtistList.Visible = IsOpen.Value

end)

--if IsOpen is false, it will be changed to true, then Visible will be set to true
--if IsOpen is true, it will be changed to false then Visible will be set to false
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
13 Apr 2017 09:55 AM
If IsOpen is set to true, it will follow the rest of the code, check if IsOpen is set to true, and if yes it will close the gui.
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
13 Apr 2017 09:55 AM
Use an elseif statement for it.
Report Abuse
xxxtentaci_on is not online. xxxtentaci_on
Joined: 08 Jan 2012
Total Posts: 1767
13 Apr 2017 08:31 PM
But if I use visible then the buttons in the frame will still be able to be clicked wouldn't they?
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
13 Apr 2017 08:31 PM
No.


Report Abuse
xxxtentaci_on is not online. xxxtentaci_on
Joined: 08 Jan 2012
Total Posts: 1767
13 Apr 2017 09:11 PM
ok
Report Abuse
vivivio is online. vivivio
Joined: 23 Jan 2012
Total Posts: 707
13 Apr 2017 09:14 PM
try to tickle
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