Hi, I use teleport asyc to teleport a player to a difference place, but I keep getting an error? I have no idea why.
tps:TeleportAsync(placeId, playersToTP, tpOptions)
Hi, I use teleport asyc to teleport a player to a difference place, but I keep getting an error? I have no idea why.
tps:TeleportAsync(placeId, playersToTP, tpOptions)
Are you calling the function from the client?
No, from the server
gfdgfdgfdgsdfasddfa
Could you show the full code and error. Also, you cannot teleport in studio, try it in the game itself.
Could you please show the code.
Can you show the code? To identify the issue.
local tps = game:GetService("TeleportService")
local Players = game:GetService("Players")
local placeId = 11284942200
Players.PlayerAdded:Connect(function(player)
local menuGuiClone = game:GetService("ServerStorage").PartyGui:Clone()
menuGuiClone.Parent = player.PlayerGui
end)
game.ReplicatedStorage.PartySystemRE.OnServerEvent:Connect(function(player, instruction, value1, value2)
if instruction == "kickPlayer" then
if game.ReplicatedStorage.Parties:FindFirstChild(value1) and value2.Parent == game.ReplicatedStorage.Parties[value1].Players then
if game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == player.Name or value2.Value == player.Name then
if game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == value2.Value then
for i, playerInParty in pairs(game.ReplicatedStorage.Parties[value1].Players:GetChildren()) do
game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[playerInParty.Value], false, value1)
end
game.ReplicatedStorage.Parties[value1]:Destroy()
else
game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[value2.Value], false, value1)
value2:Destroy()
end
end
end
elseif instruction == "createParty" then
local partyName = player.Name .. "'s Party"
partyName = game:GetService("TextService"):FilterStringAsync(partyName, player.UserId)
partyName = partyName:GetNonChatStringForBroadcastAsync()
local newParty = Instance.new("Folder")
newParty.Name = partyName
local players = Instance.new("Folder", newParty)
players.Name = "Players"
local partyLeader = Instance.new("StringValue", players)
partyLeader.Name = "Party Leader"
partyLeader.Value = player.Name
local limit = Instance.new("IntValue", newParty)
limit.Name = "PlayerLimit"
limit.Value = 2
newParty.Parent = game.ReplicatedStorage.Parties
game.ReplicatedStorage.PartySystemRE:FireClient(player, true, partyName)
elseif instruction == "joinParty" then
if game.ReplicatedStorage.Parties:FindFirstChild(value1) and #game.ReplicatedStorage.Parties[value1].Players:GetChildren() < game.ReplicatedStorage.Parties[value1].PlayerLimit.Value then
local playerValue = Instance.new("StringValue")
playerValue.Value = player.Name
playerValue.Parent = game.ReplicatedStorage.Parties[value1].Players
game.ReplicatedStorage.PartySystemRE:FireClient(player, true, value1)
end
elseif instruction == "startParty" then
if game.ReplicatedStorage.Parties:FindFirstChild(value1) and game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == player.Name then
local playersToTP = {}
for i, playerInParty in pairs(game.ReplicatedStorage.Parties[value1].Players:GetChildren()) do
table.insert(playersToTP, game.Players[playerInParty.Value])
end
local tpOptions = Instance.new("TeleportOptions")
tpOptions.ShouldReserveServer = true
tps:TeleportAsync(placeId, playersToTP, tpOptions)
end
end
end)
You can’t teleport a table of users.
I would look into using TeleportService | Documentation - Roblox Creator Hub
TeleportPartyAsync, it’s probably what you’re looking for.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.