Hello, so I have a problem when my gui opens it closes when this is in a script, but not a local script, how do I make this script work with a local script? Also just to say this is to open it, but I have tested and this is the problem it only closes when this certain scripts in a script instead of local.
Basically its a team gui, and I am trying to make the change team gui close, because currently it wont close, here is the change team script, and then the change team script.
local gui = script.Parent
local player = script.Parent.Parent.Parent
for _, child in pairs(script.Parent:GetChildren())do
local index = child.Name:find("Selection")
--if the child is a team selection button:
if index then
local teamName = child.Name:sub(1, index-1)
print(teamName)
child.MouseButton1Click:connect(function()
player.Team = game:GetService("Teams"):FindFirstChild(teamName)
gui.Enabled = false
end)
end
end
It works, you made a simple mistake by using a server script instead of a local, I recommend you familiarize your self with Server Scripts, Client Scripts, Roblox server modal.