How to play a audio file by a particular temperature?

achieve: when the core has a particular temperature, the game plays a audio file once’s

Issue: it doesn’t play or it play mutiple times.

Tried sollutions: Changing == in to


local temp = workspace.Temp

if temp.Value  == 1400 then
	game.Workspace.coretempcrit.Playing = true
elseif temp.Value == 2000 - 2050 then
	game.Workspace.coretempcrit.Playing = true
	game.Workspace.AlarM1.Playing = true
	game.Workspace.AlarM1.Looped = true
elseif temp.Value ==2000 then
	game.Workspace.AlarM1.Playing = false
	game.Workspace.AlarM1.Looped = false
elseif temp.Value == 2800 then
	game.Workspace.prepareevac.Playing = true
	game.Workspace.BlastDoor2.Active.Value = true
	game.Workspace.AlarM1.Playing = false
	game.Workspace.AlarM1.Looped = false
	game.Workspace.Alarm2.Playing = true
	game.Workspace.Alarm2.Looped = true
	game.Workspace.Toggle.Value = true
	elseif temp.Value == 3499 then
	game.Workspace.evac.Playing = true
	game.Workspace.actualmeltdown.Meltdown.Value = true
end
	wait()
end

the temp doesn’t get exactly at that temperature so how can i make it that it is between two temperature’s?

I’ll assume that you have this in a loop somewhere, otherwise the script will only be run once.

To get it to check if the temp.Value value is within a range, use the following:

if temp.Value  >= 1400 and temp.Value  < 2000 then
	game.Workspace.coretempcrit.Playing = true
elseif temp.Value >= 2000 and temp.Value  <  2050 then
...
1 Like

thanks, it really worked great