Hello, I am Immebest a new scripter who just learned the ropes. So recently I started a new project to create a meltdown system but for some reason how much I try, I can’t just create an audio system that works. I am trying to make an alarm that would automatically trigger an sound of an well, alarm if above a certain tempreture.
I have tried using locals to reduce the labor it would take to write the script manually. Tried to write the entire thing again. Checked the value it needed to trigger, literally rewrote the script but it still didn’t work.
The script I made is this, if possible can someone tell me what I am messing up?
local Meltdown1 = false
local Temp = workspace["Core Tempreture"]
local Alarm = workspace.Sounds.Meltdown
local MELTDOWNDANGER = false
if game.workspace["Core Tempreture"]>=3000 then
Alarm:Play()
local MELTDOWNDANGER = true
end
What is Core Tempreture? An intvalue? If so, you have to put .Value after it
if Temp.Value >= 3000 then
And why are you creating another local ariable for metldowndanger?
Also, you need to make a Changed event to listen for when the value of the Temperature changes
So something like this
local Meltdown1 = false
local Temp = workspace["Core Tempreture"]
local Alarm = workspace.Sounds.Meltdown
local MELTDOWNDANGER = false
Temp.Changed:Connect(function(newVal)
if newVal < 3000 or MELTDOWNDANGER then return end
Alarm:Play()
MELTDOWNDANGER = true
end)
So well MeltdownDanger was for an event that would occur when the alarms activated, it was something to update the status boards of the core during a meltdown but I focused on this issue so much that I forget to complete it.
Well, an update on the situation it now works. Turns out the problem was actually not the script but my god damn roblox volume being off during testing. If thats not a bruh moment I dont know what is.
Pretty nice of you, taking your time out on this to change his code instead of saying like this
just make if like if the temp has changed the connect an function to it.
GOD DAMN IT DIDNT SEE THE POST ABOVE LOL