Honuluau
(Honuluau)
#1
Basically, there’s an X button to close a GUI. It doesn’t disable the GUI but the output says otherwise.
script.Parent.MouseButton1Click:Connect(function()
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
print(script.Parent,script.Parent.Parent,script.Parent.Parent.Parent,script.Parent.Parent.Parent.Parent,script.Parent.Parent.Parent.Parent.Parent)
local gui = player.PlayerGui:WaitForChild("BoothGui")
gui.Enabled = false
print(gui)
print('gui disabled')
end)
I literally have no idea why this Isn’t working.
Does anyone know what’s happening?
Volieb
(Vinny)
#2
You are using a server script inside of a GUI. Try changing this to a LocalScript
With this, you can set the player variable to game.Players.LocalPlayer
D0RYU
(nici)
#3
you can use server scripts in StarterGui, but yea it is better to do this locally instead of doing it for everyone on the server
1 Like
Honuluau
(Honuluau)
#4
Its weird that it works in only local scripts but im glad. Most of my Gui Stuff is in serverscripts and still functions normally.
Volieb
(Vinny)
#5
Mhm. Sometimes you can get away with it, but you should try to stick to doing GUI scripts locally. Glad to help!
2 Likes