SinClosed
(history)
January 28, 2022, 12:01am
#1
Hello!
I am continuing my Endurance Game v2 and I want to know how can you teleport all from a specific team to a minigame?
I have a part already inside of the minigame name “TeleportBlock” and that’s where the players are supposed to be teleported at. CanCollide is off if your asking.
How can I teleport the players from the “Playing” team into the TeleportBlock?
Code:
while true do
local Status = game.ReplicatedStorage:WaitForChild("Status")
local BCG = game.ReplicatedStorage:WaitForChild("BrickColorGui")
repeat
wait(0.01)
local playerTable = #game.Players:GetPlayers()
game.StarterGui.TalkGui.TalkFrame.TalkText.Text = "Waiting for 8 players... There are "..playerTable.." players in this server!"
until
playerTable >= 1
local playerTable = #game.Players:GetPlayers()
if playerTable >= 1 then
Status.Value = "Starting..." -- change the values to what you want it to say
wait(3)
Status.Value = "Welcome to Endurance v2!"
wait(4)
Status.Value = "This is a game based off the original Endurance game made by Endurance ©."
wait(4)
Status.Value = "The rules of playing this game are very simple."
wait(3.5)
Status.Value = "You have to choose your brick color, race on challenges, Random Players except winner will be picked. Fight to death."
wait(10)
Status.Value = "This process repeats until 2 players remain! They fight to death until they run out of bricks."
wait(8)
Status.Value = "You may choose your brick color."
wait(4)
BCG.Value = true
wait(10)
BCG.Value = false
Status.Value = "We may now start this round of Endurance v2, Good Luck!"
local interVal = 20
repeat wait(1)
interVal -= 1
Status.Value = "Intermission: "..interVal
until
interVal <= 0
local maps = game.Lighting.Maps:GetChildren()
local randomMap = maps[math.random(1, #maps)]
local map = randomMap:Clone()
map.Parent = workspace
wait(2)
local randomBlockWorth = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
local BlockWorth = randomBlockWorth[math.random(1, #randomBlockWorth)]
Status.Value = "This minigame is worth "..BlockWorth.." blocks!"
wait(4)
Status.Value = "This minigame we are playing today is..."
wait(4)
Status.Value = map.Name.."!"
game.ReplicatedStorage:WaitForChild("Minigame").Value = map.Name
wait(3)
Status.Value = "Good luck!"
wait(3)
local players = game.Teams.Playing:GetPlayers()
end
end
Thanks!
From,
SinClosed
while true do
local Status = game.ReplicatedStorage:WaitForChild("Status")
local BCG = game.ReplicatedStorage:WaitForChild("BrickColorGui")
repeat
wait(0.01)
local playerTable = #game.Players:GetPlayers()
game.StarterGui.TalkGui.TalkFrame.TalkText.Text = "Waiting for 8 players... There are "..playerTable.." players in this server!"
until
playerTable >= 1
local playerTable = #game.Players:GetPlayers()
if playerTable >= 1 then
Status.Value = "Starting..." -- change the values to what you want it to say
wait(3)
Status.Value = "Welcome to Endurance v2!"
wait(4)
Status.Value = "This is a game based off the original Endurance game made by Endurance ©."
wait(4)
Status.Value = "The rules of playing this game are very simple."
wait(3.5)
Status.Value = "You have to choose your brick color, race on challenges, Random Players except winner will be picked. Fight to death."
wait(10)
Status.Value = "This process repeats until 2 players remain! They fight to death until they run out of bricks."
wait(8)
Status.Value = "You may choose your brick color."
wait(4)
BCG.Value = true
wait(10)
BCG.Value = false
Status.Value = "We may now start this round of Endurance v2, Good Luck!"
local interVal = 20
repeat wait(1)
interVal -= 1
Status.Value = "Intermission: "..interVal
until
interVal <= 0
local maps = game.Lighting.Maps:GetChildren()
local randomMap = maps[math.random(1, #maps)]
local map = randomMap:Clone()
map.Parent = workspace
wait(2)
local randomBlockWorth = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
local BlockWorth = randomBlockWorth[math.random(1, #randomBlockWorth)]
Status.Value = "This minigame is worth "..BlockWorth.." blocks!"
wait(4)
Status.Value = "This minigame we are playing today is..."
wait(4)
Status.Value = map.Name.."!"
game.ReplicatedStorage:WaitForChild("Minigame").Value = map.Name
wait(3)
Status.Value = "Good luck!"
wait(3)
local players = game.Players:GetPlayers()
for i,v in pairs(players) do -- loops to remove all the players who aren't in the round
if v:IsA("Player") then
if not v.Team == game.Teams.Playing then
table.remove(players, table.find(players, v)) -- removes them since they aren't in the team
end
end
end
for i,v in pairs(players) do -- teleport all the players inside the playing team since we removed all the ones who aren't in the playing team
if v:IsA("Player") then
local Char = v.Character
if Char then
Char:PivotTo() -- put the spawn's CFrame between the pivotTo's brackets.
end
end
end
end
end
@SinClosed if u have any questions then feel free to ask
SinClosed
(history)
January 28, 2022, 12:17am
#3
I forgot to note out, this is what I tried and I don’t really want to wait for every single player to get into the minigame. I want all of them to teleport to the block at once. Thanks though!
It does teleport them to a block at once. You just gotta edit the brackets to have the spawns’ cframe and it will.
SinClosed
(history)
January 28, 2022, 12:24am
#5
Oh really? I always thought using that code would delay the teleportation lol.
SinClosed
(history)
January 28, 2022, 12:25am
#6
Where do I have to edit the brackets?
It wont delay.Try it. If u have any questions then feel free to ask. Just edit the get pivot’s brackets to have the spawns cframe
SinClosed
(history)
January 28, 2022, 12:30am
#9
So it removes everyone thats not on the playing team? Theres a spectators team too.
Well you just change the player’s team. Yes it removes everyone from the table who’s not on the playing team
SinClosed
(history)
January 28, 2022, 12:33am
#11
Is this better?
while true do
local Status = game.ReplicatedStorage:WaitForChild("Status")
local BCG = game.ReplicatedStorage:WaitForChild("BrickColorGui")
repeat
wait(0.01)
local playerTable = #game.Players:GetPlayers()
game.StarterGui.TalkGui.TalkFrame.TalkText.Text = "Waiting for 8 players... There are "..playerTable.." players in this server!"
until
playerTable >= 1
local playerTable = #game.Players:GetPlayers()
if playerTable >= 1 then
Status.Value = "Starting..." -- change the values to what you want it to say
wait(3)
Status.Value = "Welcome to Endurance v2!"
wait(4)
Status.Value = "This is a game based off the original Endurance game made by Endurance ©."
wait(4)
Status.Value = "The rules of playing this game are very simple."
wait(3.5)
Status.Value = "You have to choose your brick color, race on challenges, Random Players except winner will be picked. Fight to death."
wait(10)
Status.Value = "This process repeats until 2 players remain! They fight to death until they run out of bricks."
wait(8)
Status.Value = "You may choose your brick color."
wait(4)
BCG.Value = true
wait(10)
BCG.Value = false
Status.Value = "We may now start this round of Endurance v2, Good Luck!"
local interVal = 20
repeat wait(1)
interVal -= 1
Status.Value = "Intermission: "..interVal
until
interVal <= 0
local maps = game.Lighting.Maps:GetChildren()
local randomMap = maps[math.random(1, #maps)]
local map = randomMap:Clone()
map.Parent = workspace
wait(2)
local randomBlockWorth = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
local BlockWorth = randomBlockWorth[math.random(1, #randomBlockWorth)]
Status.Value = "This minigame is worth "..BlockWorth.." blocks!"
wait(4)
Status.Value = "This minigame we are playing today is..."
wait(4)
Status.Value = map.Name.."!"
game.ReplicatedStorage:WaitForChild("Minigame").Value = map.Name
wait(3)
Status.Value = "Good luck!"
wait(3)
local players = game.Players:GetPlayers()
for i,v in pairs(players) do -- teleport all the players inside the playing team since we removed all the ones who aren't in the playing team
if v:IsA("Player") then
if v.Team == game.Teams:WaitForChild("Playing") then
local Char = v.Character
Char:PivotTo(map:WaitForChild("TeleportToMinigame").CFrame) -- put the spawn's CFrame between the pivotTo's brackets.
end
end
end
end
end
Yeah u can do that. It should work