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!
I am making multiplayer mode for my game with a lobby system. -
What is the issue? Include screenshots / videos if possible!
When testing in-game, not in studio because teleports dont work there, it says “Attemt to teleport to a place that is restricted.” -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I could not find any solutions for this problem.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Host Start Button code:
local multiplayerTeleport = game:GetService("ReplicatedStorage"):WaitForChild("multi")
script.Parent.MouseButton1Click:Connect(function()
local myLobby
for i, v in pairs(game.Workspace.Lobbies:GetDescendants()) do
if v.Name == game.Players.LocalPlayer.Name then
if not (v.Parent == game.Workspace.Lobbies) then
myLobby = v.Parent
end
end
end
local plrs = {}
for i, v in pairs(myLobby:GetChildren()) do
table.insert(plrs, game.Players[v.Name])
end
multiplayerTeleport:FireServer(plrs)
end)
Multiplayer Teleport Code:
--multi = multiplayer teleport event
multi.OnServerEvent:Connect(function(player, plrs)
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local SafeTeleport = require(ServerScriptService.SafeTeleport)
local TeleportService = game:GetService("TeleportService")
local reservedServerCode = TeleportService:ReserveServer(9387049702)
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ReservedServerAccessCode = reservedServerCode
SafeTeleport(game.PlaceId, plrs, teleportOptions)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.