Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I go about making something run again when a value changes?

Asked by 4 years ago
Edited 4 years ago

How would I make this continue running so that after waiting.value is false and i turn it back to true how do i make that work

local Waiting = script.Parent.Parent.Parent.Wait
local Te = script.Parent
local Temp = game.ServerStorage.Temp


    if Waiting.Value == true then
        while Waiting.Value == true do
            Te.Text = "The Temperature is"
            wait(.5)
            Te.Text = "The Temperature is."
            wait(.5)
            Te.Text = "The Temperature is.."
            wait(.5)
            Te.Text = "The Temperature is..."
            wait(.5)
        end
    end

    if Waiting.Value == false then
        Te.Text = 'The Temperature is \n'..Temp.Value
    end
0
You never make the value to false, so no wonder, your code will never reach the false. Gabe_elvin1226aclan 323 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Nevermind just put it in a while true loop

local Waiting = script.Parent.Parent.Parent.Wait
local Te = script.Parent
local Temp = game.ServerStorage.Temp




while true do
    if Waiting.Value == true then
        while Waiting.Value == true do
            Te.Text = "The Temperature is"
            wait(.5)
            Te.Text = "The Temperature is."
            wait(.5)
            Te.Text = "The Temperature is.."
            wait(.5)
            Te.Text = "The Temperature is..."
            wait(.5)
        end
    end

    if Waiting.Value == false then
        Te.Text = 'The Temperature is \n'..Temp.Value
    end
end
0
You clearly did not get it, 'how to change it back to true' as they said. Gabe_elvin1226aclan 323 — 4y
Ad

Answer this question