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 =[
Put the conditional statement in a loop. You might have to change your stuff though. The conditional statement only works once, and it wont reactivate itself after the script runs by it. (unless you meme'd it around and put it in a loop or some other stuff like that)