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

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

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

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

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