The title says it all,
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 RAP = Instance.new("IntValue", folder)
RAP.Name = "RAP"
local CrateBux = Instance.new("IntValue", folder)
CrateBux.Name = "Crate Bux"
local IsCode1Used = Instance.new("BoolValue", folder)
IsCode1Used.Name = "IsCode1Used"
local IsCode2Used = Instance.new("BoolValue", folder)
IsCode2Used.Name = "IsCode2Used"
local plrData = Data:GetAsync(prefix .. tostring(player.UserId))
if plrData then
RAP.Value = plrData[0] or 0
CrateBux.Value = plrData[1] or 0
IsCode1Used.Value = plrData[2] or false
IsCode2Used.Value = plrData[3] or false
else
Data:SetAsync(prefix .. tostring(player.UserId), {
RAP.Value,
CrateBux.Value,
IsCode1Used.Value,
IsCode2Used.Value
})
end
end)
game.Players.PlayerRemoving:Connect(function(player)
Data:SetAsync(prefix .. tostring(player.UserId), {
player.leaderstats['RAP'].Value,
player.leaderstats['Crate Bux'].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))

3 comments
This would happen if you are in team create and using the data store from another user.
So you mean the Owner has to write it? because we are in team create and I script for him
The data store would be owned by him so you would not have access to it. A group has shared access.