The sound doesn’t play when it hits 12 o’clock. I’ve been searching and none of the solutions worked for me
local Bell = workspace.ClockMain.Bell
local Lighting = game:GetService'Lighting'
Lighting:GetPropertyChangedSignal'ClockTime':Connect(function()
local Time = Lighting.ClockTime
while true do
wait()
if Time == 12 then
Bell.Playing = true
end
end
end)
To make clear, the sound isn’t looped cause I dont need it looped.
You probably need to be a little less specific with your Time.
When you say if Time == 12 then and Time = 12.00001 it won’t work.
Try something like if Time >= 12 then and set up a debounce Boolean to let you know if the sound isn’t already playing.
I’d try putting if Time >= 12 and Time < 12 + (whatever your time sound length is) so it won’t keep checking anything outside this time frame
local Bell = workspace.ClockMain.Bell
local Lighting = game:GetService'Lighting'
local debounce = false
Lighting:GetPropertyChangedSignal'ClockTime':Connect(function()
local Time = Lighting.ClockTime
if Time >= 12 and debounce == false then
debounce = true
Bell.Playing = true
elseif Time <= 12 and debounce == true then
debounce = false
end
end
end)
local Bell = workspace.ClockMain.Bell --I'm guessing this is the sound name
local Lighting = game:GetService'Lighting'
local debounce = false
length = (the length of time the sound takes to play, going slightly longer shouldn't make a difference
Lighting:GetPropertyChangedSignal'ClockTime':Connect(function()
local Time = Lighting.ClockTime
if debounce == false and Time >= 12 and Time <= (12 + length) then
debounce = true
Bell:Play() -- plays the sound
task.wait(length)
end
debounce = false
end
end)
[/quote]
Your outher script was double checking the exact same information with the elseif which wasn’t required.
This way it gets the first check to see if the time is 12 or later, plays the sound, waits the length of time the sound