Hello everyone,
I have recently started using DataStore2 and I came with Incrementing problem.
Basically whenever I tried to Increment the value I get error: “attempt to perform arithmetic (add) on nil and number”.
I tried to fix it but I didnt come with any solution.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
for i,v in pairs(Lbs) do
if v.Name == LootboxChosen then
if not game:GetService("Players"):FindFirstChild(player.Name) then return end
local DataStore2 = require(1936396537)
local NormalLootboxData = DataStore2("NormalLootbox", player)
if v.Name ~= "None" and game:GetService("Players"):FindFirstChild(player.Name) then
print("Not None")
if v.Name == "NormalLootbox" then
print("Lootbox")
NormalLootboxData:Increment(1)
print("Received")
end
end
end
end
end)
end)
Thanks for any solution!