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

How to edit player propirity?

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)

1 comment

0

It will not find the player because no value is set and you got to do player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1000

1 answer

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)

3 comments

0

also add a wait

0

Debounce is there

0

Thank you!

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