You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Make the button close
What is the issue? Include screenshots / videos if possible!
Clicking Close Gui does nothing.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Iβve tried rewriting the script, and looking for solutions on devforum.
local player = game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if player then
wait(0.50)
player.PlayerGui.ScreenGui.Frame.Visible = true
script.Parent.Text = "Close Warning GUI"
else
player.PlayerGui.ScreenGui.Frame.Visible = true
wait(0.5)
player.PlayerGui.ScreenGui.Frame.Visible = false
script.Parent.Text = "Open Warning GUI"
end
end)
Localscript ^
ServerScript:
wait(5)
print("Connected")
for i, player in ipairs(game.Players:GetPlayers()) do
if player:GetRankInGroup(5251XXX) == 9 or 10 or 12 or 13 or 14 or 15 or 16 or 17 or 255 then
player.PlayerGui.Warn.TextButton.Visible = true
print(player.PlayerGui)
end
end
Weβre focusing on the localscript, not the ServerScript.
Try using this code that i have edited from the code u have in the local script
local player = game.Players.LocalPlayer
local state = false -- the gui is closed if its false
script.Parent.MouseButton1Click:Connect(function()
if not state then
wait(0.50)
player.PlayerGui.ScreenGui.Frame.Visible = true
script.Parent.Text = "Close Warning GUI"
state = true
else
player.PlayerGui.ScreenGui.Frame.Visible = false
script.Parent.Text = "Open Warning GUI"
state = false
end
end)
well actually you can change gues with player gui, player gui is what holds screen gui it has nonething to do with changing stuff, you could test it with
local playerGui = game:GetService("Players").LocalPlayer.PlayerGui
local gui = script.Parent -- place this local script in a screen gui
wait(10)
gui.TextLabel.Text = "this is one method" -- have the gui have a textlabel in it
wait(10)
playerGui.ScreenGui.TextLabel.Text = "This also works"
but besides that what is the preset text for the textbutton?