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

how to wait until value reaches the desired amount?

Asked by 2 years ago
Edited 2 years ago
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

Log in to vote
0
Answered by 2 years ago

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!!

Ad

Answer this question