Visible set to false, but GUI is still appearing

Hello,
I set a GUI’s visibility to false in my script, but it’s not working. Here’s the script (note that this is a Local Script):

local trivago = script.Parent:WaitForChild("Trivago")

local TweenService = game:GetService("TweenService")
local chatmessage = game:GetService("Chat")
local USECOUNT = 0
local player = game:GetService("Players").LocalPlayer

player.Chatted:Connect(function(msg)
	
	if msg == "hotel?" then
		trivago.Visible = true
		local tweenInfo = TweenInfo.new(
			3,
			Enum.EasingStyle.Quart,
			Enum.EasingDirection.InOut,
			-1,
			true,
			0
		)
		
		local tween = TweenService:Create(trivago,tweenInfo,{Rotation = trivago.Rotation + 250})
		
		tween:Play()
		
	end
	
	if msg == "stop, i dont want a hotel!" and USECOUNT == 0 then
		
		trivago.Visible = false
		USECOUNT = USECOUNT + 1
		game.StarterGui:SetCore("ChatMakeSystemMessage",{Text = "[System]: I saved you from that hotel.."})
		
		if USECOUNT > 1 and msg == "stop!" then
			trivago.Visible = false
			game.StarterGui:SetCore("ChatMakeSystemMessage",{Text = "[System]: I saved you from that hotel.. again. Don't do it again... please. You've been doing this for " .. USECOUNT .. " times. LIKE STOP!"})
		end
	end
	
end)

I don’t know what to do; If you can help, please do! Thank you.

have you confirmed that the line that is making the gui (i’m assuming the gui you’re talking about is trivago) is actually being run? try putting a breakpoint on it or a print statement directly after it.

Also, could you show us what trivago actually is? (i.e a screen shot of it’s hierarchy in the explorer)

1 Like

I already solved it, but thank you for the response.

1 Like

You need to set the Tween’s Completed event to the Visible property.
tween.Completed:Connect(function()
trivago.Visible = false
end)