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

How do i make the backpack stop going up when wheat's value is greater than storage's value?

Asked by 5 years ago
local BackPack = script.Parent.BackPack

local Player = game.Players.LocalPlayer

local Wheat = Player.leaderstats.Wheat

local Storage = script.Parent.Storage.Value

local Storage = "25"

BackPack.Text = Player.leaderstats.Wheat.Value.."/"..Storage

Wheat.Changed:Connect(function()

BackPack.Text = Player.leaderstats.Wheat.Value.."/"..Storage

end)

1 answer

Log in to vote
0
Answered by 5 years ago

You could use an if statement to check the value of the collected wheat and if it's higher or the same as maximum storage, it won't allow you to collect anymore so..

If wheat.Amount.Value >= Storage then
canCollect = false
end
Ad

Answer this question