Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how to wait until value reaches the desired amount?

for _,model in pairs(game.ReplicatedStorage.ObjectFolder:GetChildren())
local Properties = model.PropertiesObj
local price = Properties.Price.Value
                            player.leaderstats.Cash:GetPropertyChangedSignal("Value"):Connect(function()
 if player.leaderstats.Cash.Value < price then
  repeat task.wait() until player.leaderstats.Cash.Value > price
 player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - price
function()
                                    
                                    
      end
end)

i want it to wait until player has enough money and perform the function

1 answer

Make an if statement Example

if Value = 100 then
script.Enabled = false
end)

This was just an example on how to use an if statement then disable script by doing Enabled = false Hope this helps!!

This discussion is preserved as it was. New answers, comments, and votes are closed.