Party script for teleporting a group of players:
local createPartyButton = script.Parent.Create
local joinPartyButton = script.Parent.Join
local leavePartyButton = script.Parent.Leave
local openTeleportParty = script.Parent.OpenTeleport
local createPartyName = script.Parent.CreatePartyName
local pubpri = script.Parent.PublicPrivate
local inviteScreen = script.Parent.InviteScreen
local invitePlayerButton = script.Parent.Invite
local teleportFrame = script.Parent.TeleportFrame
local teleportToGameID = script.Parent.TeleportFrame.TextBox
local joinPartyID = script.Parent.PartyID
local invitePlayerID = script.Parent.InvitePlayerName
local players = game:GetService("Players")
local teleportService = game:GetService("TeleportService")
local teams = game:GetService("Teams")
local player = players.LocalPlayer
function createParty() --This function seems to work but I tested it with my friend and the problem was that the team that was added to the leaderstats did not appear on his screen but appeared on the screen of the person that created the "Party".
createPartyName.Visible = true
createPartyName.Enter.MouseButton1Click:Wait()
createPartyName.Visible = false
pubpri.Visible = true
pubpri.Enter.MouseButton1Click:Wait()
pubpri.Visible = false
if (player.PlayerScripts.IsInParty.Value == true) then
player.Team.NumberOfPlayersOnTeam.Value = player.Team.NumberOfPlayersOnTeam.Value - 1
if (player.Team.NumberOfPlayersOnTeam.Value == 0) then
player.Team:Remove()
end
end
local partyHolder = Instance.new("Team")
partyHolder.Name = createPartyName.Text
partyHolder.TeamColor = BrickColor.Random()
partyHolder.AutoAssignable = false
partyHolder.Parent = teams
local numberOfplayers = Instance.new("NumberValue")
numberOfplayers.Name = "NumberOfPlayersOnTeam"
numberOfplayers.Value = 1
numberOfplayers.Parent = teams:FindFirstChild(createPartyName.Text)
local privacy = Instance.new("BoolValue")
privacy.Name = "IsPrivate"
if (pubpri.Text == "Private" or "private") then
privacy.Value = true
else
privacy.Value = false
end
privacy.Parent = teams:FindFirstChild(createPartyName.Text)
player.Team = teams:FindFirstChild(createPartyName.Text)
createPartyName.Text = ""
pubpri.Text = ""
player.PlayerScripts.IsInParty.Value = true
end
function leaveParty()
player.Team.NumberOfPlayersOnTeam.Value = player.Team.NumberOfPlayersOnTeam.Value - 1
player.PlayerScripts.IsInParty.Value = false
if (player.Team.NumberOfPlayersOnTeam.Value == 0) then
player.Team:Remove()
end
player.Team = teams:FindFirstChild("No Party")
end
function joinParty()
joinPartyID.Visible = true
joinPartyID.Enter.MouseButton1Click:Wait()
joinPartyID.Visible = false
if (teams:FindFirstChild(joinPartyID.Text).IsPrivate.Value == false) then
player.Team = teams:FindFirstChild(joinPartyID.Text)
player.Team.NumberOfPlayersOnTeam.Value = player.Team.NumberOfPlayersOnTeam.Value + 1
else
local message = Instance.new("Message")
message.Text = "The party you attempted to join is non-existant or private."
message.Parent = player.PlayerGui
wait(3)
player.PlayerGui.Message:Remove()
end
end
function inviteToParty() --This function is where another error is though im not sure what it is
invitePlayerID.Visible = true
invitePlayerID.Enter.MouseButton1Click:Wait()
invitePlayerID.Visible = false
local clonedInvite = inviteScreen:Clone()
clonedInvite.PlayerName.Text = player.Name
clonedInvite.PartyName.Value = script.Parent.PartyName.Value
clonedInvite.Parent = players:FindFirstChild(invitePlayerID.Text).PlayerGui.Party.Frame
end
function teleportParty()
teleportFrame.Visible = true
script.Parent.TeleportFrame.TextBox.Enter.MouseButton1Click:Wait()
teleportFrame.Visible = false
local gameId = 0
if (teleportToGameID.Text == "Line Runner") then
gameId = 6933729209
elseif (teleportToGameID.Text == "Capture The Flag") then
gameId = 6918246785
end
local playerList = player.Team:GetPlayers()
local success, result = pcall(function()
return teleportService:TeleportPartyAsync(gameId, playerList)
end)
if success then
local jobId = result
print("Players teleported to "..jobId)
else
warn(result)
end
end
createPartyButton.MouseButton1Click:Connect(createParty)
leavePartyButton.MouseButton1Click:Connect(leaveParty)
joinPartyButton.MouseButton1Click:Connect(joinParty)
invitePlayerButton.MouseButton1Click:Connect(inviteToParty)
openTeleportParty.MouseButton1Click:Connect(teleportParty)

3 comments
Could you please post all the errors? It makes it easier to fix!
ok
I changed it and now have two of the errors on the script, as for others, i have no clue if they exist though they probably do