School bell system that rings every hour and then stops ringing at a certain time (3:30)

So I have a day/night cycle and a school in my game, I want a bell to ring every in-game hour and then stop ringing once school ends

I’ve tried a bunch of different things but the sound either plays once as soon as I start the game or just doesn’t play at all, I can’t seem to get it to work in conjunction with the clocktime

Any help would be appreciated, thanks :slight_smile:

2 Likes

Here is some wonderful psuedocode:

local timeStart = 7
local timeEnd = 14

-- add time cycle here

function timeChange()
	if math.floor(game.Lighting.TimeOfDay) == game.Lighting.TimeOfDay and game.Lighting.TimeOfDay >= timeStart and game.Lighting.TimeOfDay <= timeEnd then
		ringBell()
	end
end
1 Like