GetLocalPlayerTeleportData only works on the server side, not in a localscript. when a player gets teleported with that data, you gotta grab it from the server first
heres what you do:
In the new place, put this in ServerScriptService:
-- Made by Mythicheart
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- make a remote to send data to client
local sendTeleportData = Instance.new("RemoteEvent")
sendTeleportData.Name = "SendTeleportData"
sendTeleportData.Parent = ReplicatedStorage
Players.PlayerAdded:Connect(function(player)
local teleportData = player:GetJoinData().TeleportData
if teleportData then
-- send it to the client
sendTeleportData:FireClient(player, teleportData)
end
end)
Then in your LocalScript:
-- Made by Mythicheart
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local sendTeleportData = ReplicatedStorage:WaitForChild("SendTeleportData")
sendTeleportData.OnClientEvent:Connect(function(data)
print("got teleport data:", data.connum, data.startingmoney)
-- use your data here
end)
basically server grabs it when player joins, then fires it to the client. cant access it directly from localscript