I am an beginner-intermediate scripter, and I am new to the DataReady, until today. I looked on the ROBLOX wiki for a template on what I need to do to make a IntValue inside a folder that keeps track of how many times you have played.
vcKey = "PlayerVisitCount"
game.Players.PlayerAdded:connect(function(player)
if player:WaitForDataReady() then
local ls = Instance.new("Folder")
ls.Name = "Visits"
ls.Parent = player
local vc = Instance.new("IntValue")
vc.Name = "VisitsCount"
vc.Parent = ls
vc.Value = player:LoadNumber(vcKey) + 1
end
end)
game.Players.PlayerRemoving:connect(function(player)
if player:FindFirstChild("Visits") then
player:SaveNumber(vcKey, player.Visits.VisitsCount.Value)
end
end)
When I run it, the folder doesn't even appear inside the player. When I check the output window to see an error, there are no errors either.
