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