I know its very disorganized and extremely old for starters. I found this old script i tried editing it myself in order to make it work but I'm not sure what's wrong with it, if I could please receive so helpful feedback I would really appreciate it! The goal was to have a chat command that would give points to a player and would save when the player left and comes back even on a new server (Data Save?). Example i would say [LevelGuest3 giving the guest 3 points.
local groupId =
local dataStore = game:GetService("DataStoreService"):GetDataStore("UserCredits")
if game.CreatorType == Enum.CreatorType.Group then
groupId = game.CreatorId
elseif game.CreatorType == Enum.CreatorType.User and groupId < 1 then
local hint = Instance.new("Hint",game.Workspace)
hint.Text = "YouFoundMy Leaderboard - Uh oh! Group ID was not found! Please try again!"
game:GetService("Debris"):AddItem(hint,30)
end
game.Players.PlayerAdded:connect(function(player)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
stats.Parent = player
local credits = Instance.new("IntValue")
credits.Name = "Credits"
credits.Parent = stats
if groupId > 0 then
local rank = Instance.new("StringValue")
rank.Name = "Rank"
rank.Value = player:GetRoleInGroup(groupId)
rank.Parent = stats
end
if dataStore:GetAsync("Key" .. player.UserId) then
credits.Value = dataStore:GetAsync("Key" .. player.UserId)
else
credits.Value = 0
end
credits.Changed:connect(function(save)
dataStore:SetAsync("Key" .. player.UserId, save)
end)
end)

1 comment
Hints are depricated, I wanna see incapaz's reaction to this xD