I used to have an old one that works but after the game pass update it broke?

Any help? Please and thank you!

What I mean: You have a game pass, the script checks if you have that game pass, if so gives you Cash from the leader stats.

This is my leaderboard script


local datastore = game:GetService("DataStoreService")
local data1 = datastore:GetDataStore("mycashdata")
local data2 = datastore:GetDataStore("myrebirthsdata")
local data3 = datastore:GetDataStore("myKillssdata")

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local rebirths = Instance.new("IntValue", leaderstats)
rebirths.Name = "Cash"
local strength = Instance.new("IntValue", leaderstats)
strength.Name = "Kills"
strength.Value = data1:GetAsync(player.UserId) or 0
data1:SetAsync(player.UserId, strength.Value)
rebirths.Value = data2:GetAsync(player.UserId) or 0
data2:SetAsync(player.UserId, rebirths.Value)

game.Players.PlayerRemoving:connect(function()
data1:SetAsync(player.UserId, strength.Value)
data2:SetAsync(player.UserId, rebirths.Value)
end)
end)

3 comments

0

Holy crap indent your code

0

Please indent | use Connect not connect | Do not use the 2nd arguement of Instance.new | use pcalls for data saving and reading | use better datastore names and variable names

0

Then you post an answer