|
| 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 |
|
|
|
| 12 Apr 2017 11:21 PM |
local IsOpen = script.Parent.IsOpen.Value
|
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Apr 2017 11:23 PM |
There is still something not working ;-;
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 13 Apr 2017 09:55 AM |
| Use an elseif statement for it. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
| |
|
vivivio
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 707 |
|
| |
|