game.Players.PlayerAdded:Connect(function(plr)

local a = Instance.new("Folder",plr)

a.Name = "leaderstats"

local m = Instance.new("IntValue",a)

m.Value = 0

m.Name = "Cash"

local x = Instance.new("IntValue",a)

x.Value = 0

x.Name = "Bananas"

local r = Instance.new("IntValue",a)

r.Value = 0

r.Name = "Rebirths"

local r = Instance.new("IntValue",plr)

r.Value = 5

r.Name = "wait"

end)

  

  

while true do

wait(1)

for i, v in pairs(game.Players:GetChildren()) do

if v:FindFirstChild("leaderstats") ~= nil then

if v.leaderstats:FindFirstChild("Bananas") ~= nil then

v.leaderstats.Bananas.Value = v.leaderstats.Bananas.Value end

end

end

end

4 comments

0

I can't help if you don't explain the issue..

0

Im trying to make the values rebirth, Cash and Bananas save their value when the player leaves and rejoins. How do i incorporate that into this script?

0

Im having trouble adding datastore with the values in the script