Hello. The case is really difficult, the logic of the script is to receive an item from the storage server, if the value is True, the item is not received. I have already tried everything, I don’t know what to do, please help me!
local DSS = game:GetService("DataStoreService")
local playersDB = DSS:GetDataStore("playerssfd")
local ss = game:GetService("ServerStorage")
local function savePlayerData(player)
local success, error = pcall(function()
local data = {
Ladder = player:WaitForChild("Items"):WaitForChild("Ladder").Value,
GoldenRevolver = player:WaitForChild("Items"):WaitForChild("GoldenRevolver").Value,
}
playersDB:SetAsync(tostring(player.UserId), data)
end)
end
game.Players.PlayerAdded:Connect(function(player)
local items = Instance.new("Folder")
items.Name = "Items"
items.Parent = player
local ladder = Instance.new("BoolValue")
ladder.Name = "Ladder"
ladder.Parent = items
local GoldenRevolver = Instance.new("BoolValue")
GoldenRevolver.Name = "GoldenRevolver"
GoldenRevolver.Parent = items
local success, data = pcall(function()
return playersDB:GetAsync(tostring(player.UserId))
end)
if success and data then
ladder.Value = data.Ladder or false
GoldenRevolver.Value = data.GoldenRevolver or false
end
local Ladder = ss:WaitForChild("dmin"):WaitForChild("Ladder")
local revo = ss:WaitForChild("dmin"):WaitForChild("GoldenRevolver")
if player:WaitForChild("Items"):WaitForChild("Ladder").Value == true then
local item = Ladder:Clone()
item.Parent = player.Backpack
print(player:WaitForChild("Items"):WaitForChild("Ladder").Value)
else
print(player:WaitForChild("Items"):WaitForChild("Ladder").Value)
end
if player:WaitForChild("Items"):WaitForChild("GoldenRevolver").Value == true then
local item = revo:Clone()
item.Parent = player:WaitForChild("Backpack")
print(player:WaitForChild("Items"):WaitForChild("GoldenRevolver").Value)
else
print(player:WaitForChild("Items"):WaitForChild("Ladder").Value)
end
ladder.Changed:Connect(function()
savePlayerData(player)
end)
GoldenRevolver.Changed:Connect(function()
savePlayerData(player)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
savePlayerData(player)
end)