Not boring you with anything heres the code, its to save the discord UserId of the player. it’s for my money logging system.
-- Variables --
local DS = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local CoinsDataStore = DS:GetDataStore("CoinsDS")
local SM = require(script.DiscordStats)
Players.PlayerAdded:Connect(function(Player)
local key = -- not telling
print("Data Key of " .. Player.Name .. ":" .. key)
local Coins = SM.AddPlayerStats(Player)
local success, CoinData = pcall(function()
return CoinsDataStore:GetAsync(key)
end)
Coins.Value = (type(CoinData) == "number" and CoinData) or 0
end)
Players.PlayerRemoving:Connect(function(Player)
local key = --not telling
local DcData = Player.Discord
local Coins = DcData.UUID.Value
CoinsDataStore:UpdateAsync(key, function(oldData)
return Coins
end)
end)
If anyone could help me i would love it!