Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

2 comments

0

I think you need to use TeleportService instead of changing the CFrame of the torso

0

How do I use TeleportService?

2 answers

✓ Accepted answer

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

Is there an error? IN the output.

1 comment

0

No it does not come up with anything.

This discussion is preserved as it was. New answers, comments, and votes are closed.