Hello, basically this while true do() is completely stopping and won’t restart as I put in “break”. If I print something, it keeps going on and on, how do I make the loop STOP but also restart once the value has changed again.
The script:
while true do
wait(1)
if carryon2 == false then
script.Parent.Value.Value -= 1
if script.Parent.Value.Value == 0 then
script.Parent.gangName.Value = game.Players:FindFirstChild(playerName).gangSystem.gangName.Value
script.Parent.BillboardGui.TextLabel.Text = game.Players:FindFirstChild(playerName).gangSystem.gangName.Value
script.Parent.BillboardGui.TextLabel.TextColor3 = game.Players:FindFirstChild(playerName).gangSystem.gangColour.Value
break
end
end
if carryon2 == true then
print("err")
end
end
One way would be to add it to a function and when you need to run it just call the function. Also could you not have the true part of the loop set to script.Parent.Value.Vaue== 0 rather then using the break.
while true do
wait(1)
if carryon2 == false then
script.Parent.Value.Value -= 1
if script.Parent.Value.Value == 0 then
script.Parent.gangName.Value = game.Players:FindFirstChild(playerName).gangSystem.gangName.Value
script.Parent.BillboardGui.TextLabel.Text = game.Players:FindFirstChild(playerName).gangSystem.gangName.Value
script.Parent.BillboardGui.TextLabel.TextColor3 = game.Players:FindFirstChild(playerName).gangSystem.gangColour.Value
break
end
end
if carryon2 == true then
print("err")
end
end
i have an idea, use a boolvalue and detect when the numver value is below 0, when it is set it to true, then do an if statement check in teh while true
Well he wants to break the loop as said in his post “How do I make the loop stop but also restart once the value has changed again”. So he’s obviously changing it elsewhere too.
To restart the loop just call the function via :GetPropertyChangedSignal