So im currently making a queue system similar to doors, I have 2 gamemodes, Normal mode and Endless mode. They all teleport to one place. How would I go about sending data about what gamemode they have chosen. I have read about the teleport service but it just doesnt seem to make any sense for me. Any code samples or explained answers would really help. Thank you for reading
TeleportOptions maybe useful
Do you know how script the queue system?
Okay so when I teleport them to the actual game, would I use the teleport async with the teleport options such as {Gamemode = “Normal”}, then use Get local teleport data. Problem is if the client receives it I need the server to know what gamemode it is not the client. Thank you for your response.
Yeah so essentially queue is done, I have a table of players ready to be teleported when the queue is over. Only problem is transferring data from server to server via teleport
I found in a video this script that works like a bindable event but without it.
Main Game:
local TeleportService = game:GetService("TeleportService")
local placeId = writethere
game.Players.PlayerAdded:Connect(function(player)
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ShouldReserveServer = true
local teleportData = {
Test = "ok"
Number = 3,
}
teleportOptions:SetTeleportData(teleportData)
TeleportService:TeleportAsync(placeId, {player}, teleportOptions)
end)
Place to teleport
game.Players.PlayerAdded:Connect(function(player)
local joinData = player:GetJoinData()
local teleportData = joinData.TeleportData
local test = teleportData.Test
local number = teleportData.Number
print(test)
print(number)
end)
credit of the video: BrawlDev - Teleport Service
that’s correct, just make sure that they are both local scripts.
Local scripts? In the video are scripts.
No, they must be local scripts, you can’t send data to the server.
Thank you very much ill leave it as the solution much appreciated
is there any way to send data to the server, it will kinda unrealistic to have every client send the gamemode data
use remote events.
local joinData = player:GetJoinData()
local teleportData = joinData.TeleportData
local test = teleportData.Test
local number = teleportData.Number
remoteEvent:FireServer(test, number)
Ok thank you, I thought it would be more prone to hackers but itll do cheers
no problem, just remember always put your if
statements on the server, since hackers can’t access server scripts
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.