So basically I am doing a database thing trying to create clicking simulator everything looked great until I tried saving rebirths too. The error is:
23:18:39.311 ServerScriptService.Main Script Holder:42: attempt to index number with ‘clicks’ - Server - Main Script Holder:42
23:18:39.311 Stack Begin - Studio
23:18:39.311 Script ‘ServerScriptService.Main Script Holder’, Line 42 - Studio - Main Script Holder:42
23:18:39.312 Stack End - Studio
And the code is:
players.PlayerAdded:Connect(function(plr)
local lb = Instance.new(“Folder”)
lb.Name = “leaderstats”
lb.Parent = plr
local clicks = Instance.new(“IntValue”)
clicks.Name = “Clicks”
clicks.Parent = lb
local rebirths = Instance.new(“IntValue”)
rebirths.Name = “Rebirths”
rebirths.Parent = lb
local cAmount
local success, err = pcall(function()
cAmount = data:GetAsync(“Clicks_”…plr.UserId)
end)
if success then
if cAmount then
clicks.Value = cAmount.clicks
rebirths.Value = cAmount.rebirths
else
clicks.Value = 0
rebirths.Value = 0
end
else
warn(err)
end