local myvalues = {}
print("latest")
game.Players.PlayerAdded:Connect(function(player)
local id = player.UserId
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
myvalues["intvalue"] = Instance.new("IntValue")
myvalues["intvalue"].Parent = leaderstats
local success,ttable = pcall(function()
store:GetAsync(id)
end)
if success then
myvalues["intvalue"].Value = ttable["intvalue"].Value or 0
end
end)
errors on this
myvalues["intvalue"].Value = ttable["intvalue"].Value or 0
ServerScriptService.Script:25: attempt to index nil with ‘intvalue’
local success,ttable = pcall(function()
return store:GetAsync(id)
end)
the second value that is returned by the pcall function is the value returned by the function inside the pcall, or if it fails it returns the error string
May I also suggest noting that Instance.new has a second parameter for where the instance should be parented to which can almost always save you an extra line of code