I created a place lets called it the place A, the start place. Place B is the other place within the game.
This is place A script when the player enters the game:
local data = game:GetService("DataStoreService")
local m = data:GetDataStore("money")
game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("Folder", p)
stats.Name = "leaderstats"
local cash = Instance.new("NumberValue", stats)
cash.Name = "cash"
cash.Value = m:GetAsync(p.UserId) or 100
m:SetAsync(p.UserId, cash.Value)
cash.Changed:connect(function()
m:SetAsync(p.UserId, cash.Value)
print("saving:"..p.Name.." data")
end)
end)
game.Players.PlayerAdded:connect(function(p)
p:WaitForChild("leaderstats")
m:SetAsync(p.UserId, p.leaderstats.cash.Value)
end)
Place A: Has a value and I want to teleport the data to place B. Is it possible to teleport a data to place B that is in place A?
This is place B script:
game.Players.PlayerAdded:connect(function(p)
local d = game:GetService("TeleportService"):GetLocalPlayerTeleportData()
d.Parent = p
print("Data is transfered!")
end)
Every time I joined place B with my teleport script:
local TeleportService = game:GetService("TeleportService")
local vb = 1532404369
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
TeleportService:Teleport(vb, player, player.leaderstats)
end
end
script.Parent.Touched:connect(onTouched)
vb is the place B and I want to teleport the data to place B. What am I doing wrong?
