Still have questions? Join our Discord server and get real time help.
0

Im creating a core, that activates a ton of effects once the temperature reaches 1600 degrees, and heres what I have

wait(1)
local act = _G.actvalue -- The global value
local inuse = false -- This is neccecary only for the script to not break

function alarmchange(button)
if not inuse then
inuse = true
if act.Value == "Inactive" then
act.Value = button.Name
wait(2)
elseif act.Value == button.Name then
act.Value = "Inactive"
wait(2)
else
button.Text = "Error: "..act.Value.." Alert Enabled"
wait(2)
end
inuse = false
end
end

function effectactivator()
if game.Workspace.Coretemps.Temp.Current.Value > 1600 then
alarmchange(script.Parent.Red)
end
if game.Workspace.Coretemps.Temp.Current.Value < 1600 then
alarmchange(script.Parent.Inactive)
end
end

game.Workspace.Coretemps.Temp.Current.Changed:Connect(effectactivator)
game.Workspace.Coretemps.Temp.Current.Changed:Connect(alarmchange)



Once the core reaches 1600 degrees, it changes the global value to "Red" which is supposed to activate the effects, but instead the effects only activate if I set the temp above 1600 before starting the server?

Not sure what I did wrong, and I know im using a global value, but I don't want to change anything that isn't directly causing things to not work.

Thanks! -Jonathox

Edit- Nobody has given me a working solution yet =[

0
what is wrong with using a global value? justoboy13 153 — 2y
0
Did you mean to put `>= 1600 in your "effectactivator()" function? That's a very simple fix if you want it to go off at exactly 1600 and not only when it's above. MooMooThalahlah 421 — 2y
0
No, I want it to continue going off at all numbers above 1600 Jonathox 4 — 2y