I made a basic text button for a game but it doesn’t seem to be working for some reason.
Script
local request = game.StarterGui.MainGUI.request
local visible = false
script.Parent.MouseButton1Click:Connect(function()
if visible == false then
visible = true
request.Visible = true
end
end)
script.Parent.MouseButton1Click:Connect(function()
if visible == true then
visible = false
request.Visible = false
end
end)
If you want to change visible, you can’t do like that.
Yes property will change but in StarterGui instead in playerGui. So player will doesn’t see changes in GUI. You don’t need 2 events.
You can try my code below.
Be sure, this code is in local script in your ScreenGui.
local ScreenGui = script.Parent -- Your screenGui.
local Frame = ScreenGui:WaitForChild("Frame") -- Your objectGui for change visible
local TextButton = ScreenGui:WaitForChild("TextButton") -- Your textbutton to click.
local visible = false
TextButton.MouseButton1Click:Connect(function()
if visible == false then
visible = true
Frame.Visible = true
else
visible = false
Frame.Visible = false
end
end)
Make sure to put this piece of code in a local script inside of the MainGui in the StarterGui
Try do this, I’m pretty sure this will work:
local MainGUI = script.Parent
local request = MainGUI:WaitForChild(“request”)
local loading = MainGUI:WaitForChild(“load”)
local visible = false
loading.MouseButton1Click:Connect(function()
if not visible then
visible = true
request.Visible = true
end
end)
loading.MouseButton1Click:Connect(function()
if visible then
visible = false
request.Visible = false
end
end)
If this solution helped you, please make sure to mark this comment as your solution
Kind regards,
KiriNini1234
local request = game:GetService("StarterGui"):WaitForChild("MainGUI"):WaitForChild("request")
local visible = false
script.Parent.MouseButton1Click:Connect(function()
if visible ~= true then
visible = true
request.Visible = true
else
visible = false
request.Visible = false
end
end)
This is probably how it should look like, if you put two same button subscriptions into one script, script won’t get Signal for your current function. And in your video, the Frame probably had Background transparency on 0 or children inside had ‘false’ on Visible property. I hope this helped you.