I am working on a core reactor game type thingy and I made two buttons, one increases the core temp by one and another decreases by one. I was wondering if there was a way to make a ScreenGui which says “Status: Stable” when it is -100 to 100 degrees, “Status: Unstable (Cold)” when under -100 degrees and “Status: Unstable (Hot)” when over 100 degrees. Please let me know!
Check get a script that checks if the value if greater then 100, less then -100 and greater then -100 and less then 100
…yes, how would I implement this?
Like this: (Sorry, not the best)
Value = 0 -- you can change this to what ever and make it however you want
While wait() do
if Value >= 100 then
-- Over Heating
elseif Value <= -100 then
-- Over Cooling
elseif Value > -100 and Value < 100 then
-- Stable
end
end
I am sorry it was a bit before I posted, I am typing on my phone.
This works! Thank you so much!
Final script for anyone wondering:
local label = script.Parent.SurfaceGui.TextLabel
local coreTemp = game.Workspace.Core.CoreTemp
coreTemp.Changed:Connect(function()
if coreTemp.Value >= 100 then
label.Text = "Status: Unstable (Hot)"
label.TextColor3 = Color3.fromRGB(255,0,0)
elseif coreTemp.Value <= -100 then
label.Text = "Status: Unstable (Cold)"
label.TextColor3 = Color3.fromRGB(0,0,255)
elseif coreTemp.Value > -100 and coreTemp.Value < 100 then
label.Text = "Status: Stable"
label.TextColor3 = Color3.fromRGB(255,255,255)
end
end)
I just wanted to add that you could use :GetAttributeChangedSignal() (If you’re trying to check for an attribute that has been changed) or .Changed() (If you’re looking for a variable that has been changed) to basically only run a checking function like the one created above
if the value you’re looking for changes. This would make your game not be constantly checking for a value.
Hope this helps
if you have any more question, please feel free to ask
I hope you see this use-intvalue.Changed IntValue | Roblox Creator Documentation