How Do I Make This GUI Become Invisible When It Reaches A Certain Size?

Greetings and salutations! My name is Wes and I am on a quest to make a StaminaBar’s Frame become invisible when its X Scale reaches 0. To be honest, I am confused. Please help me. Thank you! :smiley:

Reason Why:
staminabargonnagowildcowboy

local gui = Players.LocalPlayer.PlayerGui.StaminaGui.Frame
local bar = gui:FindFirstChild("StaminaBar", true)
local invisiblecheck = true
if bar.Size == UDim2.new(0,0,1,0) then
	if invisiblecheck == true then
		invisiblecheck = false
		bar.Visible = false
		wait(1)
		bar.Visible = true
		invisiblecheck = true
	end
end
local gui = Players.LocalPlayer.PlayerGui.StaminaGui.Frame
local bar = gui:FindFirstChild("StaminaBar", true)
local invisiblecheck = true
bar:GetPropertyChangedSignal("Size"):Connect(function()
if bar.Size == UDim2.new(0,0,1,0) then
	if invisiblecheck == true then
		invisiblecheck = false
		bar.Visible = false
		wait(1)
		bar.Visible = true
		invisiblecheck = true
	end
end
end)

Every time bar.Size changes it will check if it has reached (0, 0, 1, 0) and make bar invisible.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.