My GUI should be hidden when i hit a button on my GUI., but it for some reason is not working

When you click on the button(s), do you atleast switch teams?

Try this code, and tell me what prints in the output (show me a screenshot of the output that shows the prints):

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("ChangeTeam")
print("Got remote event")

local Frame = script.Parent:WaitForChild("Frame")
local RedBtn = Frame.Red
local BlueBtn = Frame.Blue

local BlueColor = "Bright blue"
local RedColor = "Bright red"

print("Got the rest of the variables")

RedBtn.Activated:Connect(function()
	print("RedButton was clicked")
	Event:FireServer(BrickColor.new(RedColor))
	print("Fired event")
	Frame.Visible = not Frame.Visible
	print("Frame should be invisible now")
end)

BlueBtn.Activated:Connect(function()
	print("Blue Button was clicked")
	Event:FireServer(BrickColor.new(BlueColor))
	print("Fired Remote event")
	Frame.Visible = not Frame.Visible
	print("Frame should be invisible now")
end)

It did print the one after Frame.Visible even though it wasnt invisible

It might be because when it runs on the server, it resets the player…

1 Like

I did a test, and it seems to be that.

1 Like

So the problem had something to do with your server script (that changes the player’s team)?

yep, that was the issue. thank you