I already know how to send data through servers using teleportservice with the GetLocalPlayerData function but this data is really important
What exactly are you asking? Can you try rephrasing?
Sending teleport data is very simple. In this article, it gives this piece of code.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local teleportData = {
placeId = game.PlaceId,
jobId = game.JobId
}
TeleportService:Teleport(placeId, player, teleportData)
That is how you would send the Data. To retrieve the data:
local TeleportService = game:GetService("TeleportService")
local teleportData = TeleportService:GetLocalPlayerTeleportData()
if teleportData then
local placeId = teleportData.placeId
local jobId = teleportData.JobId
end)
Now, should you use this? Probably not. From what I’ve heard and from my personal experience this data is handled solely on the client. Which means someone could change the data you are sending. That is why you should likely use small datastores for this.
I found a function that sends it to the server so I’m okay but you can have the solution since I didnt explain well
For future readers, if you would like to receive an individual player’s TeleportData
on the Server or without having to use a RemoteEvent
. You can do this by adding the PlayerAdded
event of the Players
service. Once done, you can grab the Player
sent from the PlayerAdded
event and use Player:GetJoinData()
to grab the teleport data from that player.
Example:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player) -- Getting player who joined
local joinData = player:GetJoinData() -- Getting all of the Join Data of said "player"
local teleportData = joinData.TeleportData -- Indexing "TeleportData" from "joinData"
-- From here you can get whatever TeleportData was sent with the player.
end)
Hope this helps!