Hi, I can't turn on the beep at a temperature of 1000 or higher

hi, I can’t turn on the beep at a temperature of 1000 or higher, please help me

if (workspace.Temp.Value > 1000) then
alarms.AlarmAlert:Play()

end

Lines of code like that do not continually run. They run once and then are done. So if the temperature is not greater than 1000 on the first run, it won’t play your beep, even if the temperature starts changing.

If you want to run code when the temperature changes, you need to set up a connection to the changed event:

local temp = workspace.Temp

local function PlayBeepMaybe()
  if temp.Value > 1000 then
    alarms.AlarmAlert:Play()
  end
end

PlayBeepMaybe() -- Check it immediately
-- Check it anytime it changes:
temp.Changed:Connect(PlayBeepMaybe)
1 Like

This is correct, although:

else
	alarms.AlarmAlert:Stop()
end

is missing, in case the temperature drops.

Good point. If the audio is looped, it should be stopped.

by the way, a really cool idea

and what if have the sound repeated?