How can I make this script work during midnight in the game?

  1. What do you want to achieve? a script that changes the player’s team from mortal to witch during (ClockTime) 23-23.999 (which is as close as I can get to 24)

  2. What is the issue? I tried using a NumberRange to make it work but it didnt work (clearly)

  3. What solutions have you tried so far? not really bc I don’t even know how to make it work correctly

here’s my script so far

local proximityPrompt = script.Parent.ProximityPrompt
local gameTime = game:GetService("Lighting").ClockTime
local midnightHour = NumberRange.new(23, 23.9999)

proximityPrompt.Triggered:Connect(function(player)
	if gameTime == midnightHour then
		player.Team = game:GetService("Teams").Witch
	end
end)
1 Like

Instead of targeting that exact time maybe give the player a window of time, for example between 24:00 and 1:00 you can check what time it is like so:
if game.Lighting.ClockTime > 0 and game.Lighting.ClockTime < 1

1 Like