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
button.Text = button.Name.." Alert Enabled"
wait(2)
button.Text = "Disable "..button.Name.." Alert"
elseif act.Value == button.Name then
act.Value = "Inactive"
button.Text = button.Name.." Alert Disabled"
wait(2)
button.Text = "Enable "..button.Name.." Alert"
else
button.Text = "Error: "..act.Value.." Alert Enabled"
wait(2)
button.Text = "Enable "..button.Name.." Alert"
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 =[

3 comments
what is wrong with using a global value?
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.
No, I want it to continue going off at all numbers above 1600