local DataStore = game:GetService("DataStoreService")
local PointsData = DataStore:GetDataStore("POINTSDATA")
game.Players.PlayerAdded:Connect(function(player)
local Data1 = PointsData:GetAsync(player.UserId)
local datastats = Instance.new("Folder")
datastats.Name = "leaderstats"
datastats.Parent = player
local Points = Instance.new("IntValue")
Points.Name = "Points"
Points.Parent = datastats
local Coins = Instance.new("IntValue")
Coins.Name = "Coins"
Coins.Parent = datastats
local success, error1 = pcall(function()
PointsData:GetAsync(player.UserId)
end)
if success then
Points.Value = datastats.Points
Coins.Value = datastats.Coins
end
local groupid = 12185953
if player:GetRankInGroup(groupid) >= 5 then
while task.wait(3) do
Points.Value += 100
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
PointsData:SetAsync(player.UserId, {
["Points"] = player.datastats.Points.Value,
["Coins"] = player.datastats.Coins.Value,
["Rank"] = player.datastats.Rank.Value
})
end)
So basically, I'm making it so it saves the points and coins. I have an output. "Unable to assign property Name. string expected, got Instance " and "datastats is not a valid member of Player "Players.Comqts""
