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

How to make a backpack stop getting filled up when you max it out?

Hello,

All my questions keep getting closed I am a bad scripter don't know how to script that good. So I am here for you guys to tell me everything that's wrong with my script so I can get better and learn.

game.Workspace.sell.Part.Touched:Connect(function()
	stat.Value = 25
end)

The stat value is the Bag value in my leaderboard I am trying to make it so when someone reaches 25 it will stops or if they go over and try to sell that they only get 25.

2 comments

0

I don't get what you are asking for, so when you touch a part, it sells up to a maximum of 25?

0

No if you have over 25 in your stat then it will only sell for 25 so something like what I did when you touch the sell brick it makes it so you get only 25 in your stat witch sells and you get 25 cash.

1 answer

so here is the program that will do it

local debounce = false
function sell(part)
	if part.Parent:FindFirstChild("Humanoid") and debounce == false then
		debounce = true
		local player = game.Players:GetPlayerFromCharacter(part.Parent)
		local material = player.leaderstats.stat.Value
		if material < 25 then
			wait(3)
			debounce = false
		else
			material = material-25
			player.leaderstats.stat.Value = material
			wait(3)
			debounce = false
		end
	end
end
game.Workspace.sell.Part.Touched:Connect(sell)

I don't know if this is what you were trying to do but good luck!

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