The data transferred via teleportService is not transferring and the value remains 0. Here are the scripts am I doing anything wrong.
A teleport to B script
--make private reserve servers
local TeleportService = game:GetService("TeleportService")
local gameID = 11973353496
local JobID = game.JobId
local ReservedServer = TeleportService:ReserveServer(gameID)
local WhichSpawn = "AP"
local teleportData = {
Data1 = JobID
}
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
TeleportService:TeleportToPrivateServer(gameID, ReservedServer, {player}, WhichSpawn, teleportData)
end
end
script.Parent.Touched:connect(onTouched)
The script above sents the JobID
B teleport to A
wait()
local TeleportService = game:GetService("TeleportService")
local teleportData = TeleportService:GetLocalPlayerTeleportData()
local ReplicatedStorage = game.ReplicatedStorage
local JobIdRemoteEvent = ReplicatedStorage:WaitForChild("JobIdRecieved")
local Player1 = game.Players.LocalPlayer
local PreviousServerJobID = teleportData.Data1
JobIdRemoteEvent:FireServer(PreviousServerJobID)
Local script gets the data and fires a RemoteEvent with the data
local ReplicatedStorage = game.ReplicatedStorage
local JobIdRemoteEvent = ReplicatedStorage:WaitForChild("JobIdRecieved")
JobIdRemoteEvent.OnServerEvent:Connect(function(Player, PreviousJobID)
local PlayerPersonalJobIDValue = Instance.new("NumberValue")
PlayerPersonalJobIDValue.Parent = Player
PlayerPersonalJobIDValue.Value = PreviousJobID
PlayerPersonalJobIDValue.Name = "MyPersonalJobID"
end)
Server gets the event, makes a value and puts it in the player and assigns its value with the TeleportData. However, it remains 0. Is anything wrong with my script?
Sorry for the bad english