I made a script that saves the data of the player and its not working? Script:
local Data = game:GetService('DataStoreService'):GetDataStore('SaveDem')
local prefix = 'user_'
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new('Folder')
folder.Name = 'leaderstats'
local CaseBux = Instance.new('IntValue',folder)
CaseBux.Name = 'Crate Bux'
local IsCode1Used = Instance.new('BoolValue', folder)
IsCode1Used.Name = "IsCode1Used"
local IsCode2Used = Instance.new('BoolValue', folder)
IsCode2Used.Name = "IsCode2Used"
local RAP = Instance.new('IntValue',folder)
RAP.Name = 'RAP'
local plrData = Data:GetAsync(prefix .. tostring(player.UserId))
if plrData then
CaseBux.Value = plrData[0] or 0
RAP.Value = plrData[1] or 0
IsCode1Used.Value = plrData[2] or false
IsCode2Used.Value = plrData[3] or false
else
Data:SetAsync(prefix .. tostring(player.UserId), {
CaseBux.Value,
RAP.Value,
IsCode1Used.Value,
IsCode2Used.Value
})
end
end)
game.Players.PlayerRemoving:Connect(function(player)
Data:SetAsync(prefix .. tostring(player.UserId), {
player.leaderstats.CaseBux.Value,
player.leaderstats.RAP.Value,
player.leaderstats.IsCode1Used.Value,
player.leaderstats.IsCode2Used.Value
})
end)
error: API Services rejected request with error: HTTP 0 (HTTP 403 (HTTP/1.1 403 Forbidden))
