Hai! I'm working on a game behind bars and I was working on the bank, I have a cash system in place, but don't know how to make the value go up or down!
--Da code: game.Players.PlayerAdded:connect(function(p) local stats = Instance.new("IntValue", p) stats.Name = "leaderstats" local money = Instance.new("IntValue", stats) money.Name = "Cash" money.Value = 100
I was thinking something like:
function hit(hit) game.players.player.propirity.cash = cash + 1000 -- propirity is a real intvalue, I checked.
O.O so. um. I think thats it?
thanks, archmantella13(AKA ANE_bot)
Try this
game.Players.PlayerAdded:connect(function(p) wait() if p:FindFirstChild('leaderstats') then return else local LeaderstatsFolder = Instance.new("Folder", p) LeaderstatsFolder.Name = "leaderstats" local Money = Instance.new("IntValue", LeaderstatsFolder) Money.Name = "Cash" Money.Value = 100 end end)
and put this script inside the part
Debounce = false script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') and not Debounce then Debounce = true local player = game.Players:GetPlayerFromCharacter(hit.Parent) player:WaitForChild('leaderstats').Cash.Value = player.leaderstats.Cash.Value + 1000 wait(2) Debounce = false end end)