Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with a Team Teleporter. What should I change with the script I provided below?

Asked by 4 years ago
Edited by royaltoe 4 years ago

I am in need of help. I am trying to make it so when you press a gui button, it teleports you accordingly to your team. I tried to make a script for this but it did not work. This is the script

if game.Players.LocalPlayer.Team == game.Teams["Class-D"] then
    local function tp()
     local players = game.Players:GetPlayers()
     for i = 1,#players do
              players[i].Character.HumanoidRootPart.CFrame = game.Workspace.Teleport.CFrame + Vector3.new(0, 3, 0)
      end
end

while wait(0.1) do
       tp()
end

end

What should I change?

0
I think you need to use TeleportService instead of changing the CFrame of the torso Benbebop 1049 — 4y
0
How do I use TeleportService? BMA_Onkill -1 — 4y

2 answers

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

we talked about this over discord and came up with this solution:

we created a bunch of parts; each parts name had the same name as one of the teams in game.Teams.

we then spawn the player at whichever brick has the same name as their team name

local teamName = game.Players.LocalPlayer.Team.Name

--teleport the player if they chose a team / pressed enter
local LowerTorso = player.Character.LowerTorso
LowerTorso.CFrame = game.Workspace[teamName].CFrame
Ad
Log in to vote
0
Answered by 4 years ago

Is there an error? IN the output.

0
No it does not come up with anything. BMA_Onkill -1 — 4y

Answer this question