Well yea as the title says thats my problem. For Context I am trying to teleport all players in the party to that one place
So this is the server script:
local Plrs = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("Events").Teleport
local Queue = {}
event.OnServerEvent:Connect(function(plr, placeId, amount)
if table.find(Queue, plr) then return end
if not table.find(Queue, plr) then
table.insert(Queue, plr)
end
if #Queue <= amount then
local teleporting = {}
for i = 1, amount do
table.insert(teleporting, Queue[i]) --keeps doing this for loop and idk why
print("T") -- keeps printing T
task.wait()
end
local reservedServer = TeleportService:ReserveServer(placeId)
TeleportService:TeleportToPrivateServer(placeId, reservedServer, teleporting)
for i = 1, #teleporting do
local index = table.find(Queue, teleporting[i])
if index then
table.remove(Queue, index)
task.wait()
end
end
end
end)
Client:
Party.StartButton.Activated:Connect(function()
if plr.Name == Party.Players:WaitForChild("PlayerCard1").PlrName.Text then
for i,v in pairs(Party.Players:GetDescendants()) do
if v:IsA("TextLabel") and v.Name == "PlrName" then
if Players:FindFirstChild(v.Text) then
ReplicatedStorage:WaitForChild("Events").Teleport:FireServer(v.Text, currentMap.placeId.Value, number)
end
end
end
end
end)
I noticed that you didn’t provide the correct arguments for your remote event
--client
Teleport:FireServer(v.Text, currentMap.placeId.Value, number)
--server, plr is always there as they fired the remote event
event.OnServerEvent:Connect(function(plr, "v.Text is missing here" , placeId, amount)
its trying to teleport the players now, but I get the error:
In here:
local Plrs = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("Events").Teleport
local Queue = {}
event.OnServerEvent:Connect(function(player, plr, placeId, amount)
if table.find(Queue, plr) then return end
if not table.find(Queue, plr) then
table.insert(Queue, plr)
end
if #Queue <= amount then
local teleporting = {}
for i = 1, amount do
table.insert(teleporting, Queue[i])
task.wait()
end
local reservedServer = TeleportService:ReserveServer(placeId)
TeleportService:TeleportToPrivateServer(placeId, reservedServer, teleporting) --error here
for i = 1, #teleporting do
local index = table.find(Queue, teleporting[i])
if index then
table.remove(Queue, index)
task.wait()
end
end
end
end)
even when the amount is one it still gives me the error:
for here:
local Plrs = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("Events").Teleport
local Queue = {}
event.OnServerEvent:Connect(function(player, plr, placeId, amount)
if table.find(Queue, plr) then return end
if not table.find(Queue, plr) then
table.insert(Queue, plr)
end
if #Queue <= amount then
local teleporting = {}
for i = 1, amount do
table.insert(teleporting, Queue[i])
print("T" .. tostring(amount))
task.wait()
end
local reservedServer = TeleportService:ReserveServer(placeId)
TeleportService:TeleportToPrivateServer(placeId, reservedServer, teleporting)
for i = 1, #teleporting do
local index = table.find(Queue, teleporting[i])
if index then
table.remove(Queue, index)
task.wait()
end
end
end
end)
This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application.
The error appears when I am playing in the Roblox application. When I am playing in Studio it just says HTTP 403 Forbidden or something like that (even tough I enabled that setting)