Showing a GUI at Daytime

Hello! So I am in need of some help because I have no idea how to do this and I have tried many different things. I am making a game where things happen at night and if you survive to the day you win. I need it so when the sun comes up, a GUI appears on all players screens. I need the frame to tween in and be visible when the time is 6 to 17. I am really new at scripting sorry if this is confusing. I will be happy to clarify anything.
dwed
dde

You’ll have to track what state the frame is currently in, so you know if you need to make it visible or not.

Something like this (you need to fill out the ShowGui and HideGui functions to run the correct tweens)

local function ShouldBeVisible()
  return lighting.ClockTime >= 6 and lighting.ClockTime < 17
end

local function ShowGui()
  -- TODO
  Frame:TweenPosition(......)
end

local function HideGui()
  -- TODO
  Frame:TweenPosition(.....)
end

local currentlyVisible = false

lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
  local shouldBeVisible = ShouldBeVisible()

  if shouldBeVisible and not currentlyVisible then
    currentlyVisible = true
    ShowGui()
  elseif not shouldBeVisible and currentlyVisible then
    currentlyVisible = false
    HideGui()
  end
end
1 Like

Thank you soooo much! I have been trying to make this work for so long. I really appreciate it! :slight_smile: