I understand what the problem is now: You’re using two separate scripts for each button to open and close the Gui, but since the open variable is different for each script, it won’t change when one of the scripts sets it to a different value. To fix your problem, you’ll need to use either an attribute or a BoolValue and parent it to the Gui, and make both scripts use its value as the open variable, or make 1 LocalScript that handles the code for both buttons (imo the preferred option)
1 Like
Alright i will use one LocalScript, because idk where do i put LScript to make both GUI thing work and idk how make Cancel only close, i try script is hard like Math
Here’s what you’ll need to do:
- Add a LocalScript inside of GUI Stuff
- This will need to be the code for that LocalScript:
local guiStuff = script.Parent
local button1 = guiStuff:WaitForChild("GUI"):WaitForChild("Badges/Achievements")
local achievements = guiStuff:WaitForChild("GUI1")
local button2 = achievements:WaitForChild("ACHIEVEMENTS"):WaitForChild("CANCEL"):WaitForChild("CANCELBUTTON")
local open = true
local debounce = false
local function onButtonPress()
if debounce then return end
debounce = true
if open then
achievements:TweenPosition(UDim2.new(0.32, 0, 0.134, 0), "InOut", "Quad", 0.5, true)
open = false
else
achievements:TweenPosition(UDim2.new(0.32, 0, 1, 0), "InOut", "Quad", 0.5, true)
open = true
end
task.wait(0.5)
debounce = false
end
button1.MouseButton1Click:Connect(onButtonPress)
button2.MouseButton1Click:Connect(onButtonPress)
2 Likes
Oh… My… God, IT WORK
THANK YOU SO MUCH I JUST WANTE ALOT TIME FOR THIS
Thank you!
1 Like
set open to false.
local open = false
You’re telling the script its already open.
Also no debounce?
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.