Hello, could someone help me fix my script? It is supposed to enable another GUI, but the button is not sensing the clicks at all (not printing anything). There are also no errors in the output, and no GUIs (enabled or not) are covering it. All other buttons are also working.
Script:
local player = game.Players.LocalPlayer
local playergui = player.PlayerGui
local button = playergui.ScreenGui.IndexOpener
local gui = player.PlayerGui.IndexGUI
button.MouseButton1Click:Connect(function()
print("Clicked!")
print(tostring(gui.Enabled))
gui.Enabled = not gui.Enabled
end)
i would say try putting WaitForChild but you said thereās no errors (no index errors)
-- Put scripts that deal with multiple ScreenGui's in StarterPlayerScripts
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local IndexGui = PlayerGui:WaitForChild("IndexGui") -- Keep names consistant
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
local IndexOpener = ScreenGui:WaitForChild("IndexOpener")
IndexOpener.MouseButton1Click:Connect(function()
print("Clicked!")
print(IndexGui.Enabled)
IndexGui.Enabled = not IndexGui.Enabled
end)
Try placing a script inside the ScreenGui where it detects once the button is clicked then fires a remote event within the other gui and then have a script that toggles the gui once said remote event is fired.