Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Kai's amazing flawless point saver.
- --Enabled Studio APIs in Configure Game.
- --Publish to online place.
- local save = true --You can change to true or false. this allows the players stats to save when leaving!
- local datastore = game:GetService("DataStoreService"):GetDataStore("Stats")
- local ver = "V0.1"
- game.Players.PlayerAdded:connect(function(join)
- --Don't delete this stats and don't mess around with it unless you are good at coding!
- local stats = Instance.new('IntValue')
- stats.Name = "leaderstats"
- stats.Parent = join
- --Okay now you can create stuff right here now:
- cash = Instance.new('IntValue')
- cash.Name = "Points"
- cash.Parent = stats
- if save == true then
- --okay now to load players stats
- cash.Value = datastore:GetAsync("Points"..join.Name) --use stat name for loading! optional
- end
- end)
- game.Players.PlayerRemoving:connect(function(leave)
- if save == true then
- --we must save stats now if true
- datastore:SetAsync("Points"..leave.Name, cash.Value)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement