You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
A way to teleport players when they click a part with tables -
What is the issue? Include screenshots / videos if possible!
I keep getting HTTP 403 Forbidden error
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have turned on everything, I tried reserving the server, using teleport options, and every single command I could find on the developer hub, I also tried to get a reference code.
I am new to coding btw
local RS = game:GetService(“ReplicatedStorage”)
local RE = RS:WaitForChild(“RemoteEvent”)
local PlaceId = 0
local AmountOfPlayers = 0
local Players = game:GetService(“Players”)
local InQueue = {}
local MouseDetector = workspace.TpThing.ClickDetector
local TeleportService = game:GetService(“TeleportService”)
local ALreadyInTable = false
local reservecode = TeleportService:ReserveServer(PlaceID)
MouseDetector.MouseClick:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
AmountOfPlayers = AmountOfPlayers + 1
local char = hit.Parent
local player = game.Players:GetPlayerFromCharacter(char)
for i, OtherPlayer in next, InQueue do
if OtherPlayer == player then
ALreadyInTable = true
end
end
if not ALreadyInTable then
table.insert(InQueue,player.Name)
end
print(player)
local TpOption = Instance.new("TeleportOptions")
TpOption.ShouldReserveServer = true
wait(5)
TeleportService:TeleportToPrivateServer(PlaceId,reservecode, InQueue)
end
end)