So i look at youtube how to do it but i look on the comments u can just use datastore, now im confused and i try this script
local dsservice = game:GetService("DataStoreService")
local ds = dsservice:GetDataStore("PlayerData")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local crystal = Instance.new("IntValue")
crystal.Name = "Crystal"
crystal.Parent = leaderstats
local level = Instance.new("IntValue")
level.Name = "Level"
level.Parent = leaderstats
local win = Instance.new("IntValue")
win.Name = "Win"
win.Parent = leaderstats
local id = "Player_" ..player.UserId
local data
local success, errorMessage = pcall(function()
data = ds:GetAsync(id)
end)
if success then
crystal.Value = data
else
warn(errorMessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local id = "Player_"..player.UserId
local data = player.leaderstats.Crystal.Value
local success, errorMessage = pcall(function()
ds:SetAsync(id, data)
end)
end)
but still don't work (maybe because im using roblox studio not roblox player?) Can u guys help me?

2 comments
what data do you wanna teleport
The level and crystal and win and like if the player have a value and its true on the lobby then on the game he will have a sword