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?
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.