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
I think you need to use TeleportService instead of changing the CFrame of the torso
How do I use TeleportService?