Despite my research from the internet, nothing I do works. How do I transfer Data between Place? I copied the following script to both Places as a script: (In ServerScriptService)
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("JumpStats")
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
local Rebirths = Instance.new("IntValue", leaderstats)
Rebirths.Name = "Rebirths"
Rebirths.Value = 0
local Jumps = Instance.new("IntValue", leaderstats)
Jumps.Name = "Jumps"
Jumps.Value = 50
local Gems = Instance.new("IntValue", leaderstats)
Gems.Name = "Gems"
Gems.Value = 0
local Data = DataStore:GetAsync(Player.UserId)
if Data then
Rebirths.Value = Data.Rebirths
Jumps.Value = Data.Jumps
Gems.Value = Data.Gems
if Data.Jumps < 50 then
Jumps.Value = 50
Data.Jumps = 50
end
else
warn("Data equals to false for", Player.Name)
Jumps.Value = 50
end
end)
game.Players.PlayerRemoving:Connect(function(player)
DataStore:SetAsync(player.UserId, {
["Rebirths"] = player.leaderstats.Rebirths.Value;
["Jumps"] = player.leaderstats.Jumps.Value;
["Gems"] = player.leaderstats.Rebirths.Value;
})
end)
The script I use to teleport from the first place to the second place is:
local TeleportService = game:GetService("TeleportService")
local Place = 9968872946
local tpGui = game.ReplicatedStorage.TeleportGui
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
TeleportService:SetTeleportGui(tpGui)
TeleportService:Teleport(Place, player)
end
end)

2 comments
That's the solution, but I don't think I can mark my own message as the solution.
Can you close the thread?