local DataService = game:GetService("DataStoreService") local DataStore = DataService:GetDataStore("data1")
local cpFolder = game.Workspace:WaitForChild("Level")
game.Players.PlayerAdded:Connect(function(player) local key = "player-" .. player.UserId
local GetSave = DataStore:GetAsync(key)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local checkpoint = Instance.new("IntValue", leaderstats)
checkpoint.Name = "Level"
if GetSave then
checkpoint.Value = GetSave
print("Data Loaded For " .. player.Name)
else
checkpoint.Value = 1
print("New Data Created For " .. player.Name)
end
player.CharacterAdded:Connect(function(character)
repeat wait() until workspace:FindFirstChild(character.Name)
local player = game.Players:GetPlayerFromCharacter(character)
local checkpoint = cpFolder[player.leaderstats.Level.Value]
character.HumanoidRootPart.CFrame = checkpoint.CFrame + Vector3.new(0,2,0)
end)
end)
game.Players.PlayerRemoving:Connect(function(player) local key = "player-" .. player.UserId
DataStore:SetAsync(key, player.leaderstats.Level.Value)
print("Data Successfully Saved For " .. player.Name)
end)
The problem is WaitForChild("Level") is there anything you guys can help me
