How do I teleport all players to a different coordinates, not teleportservice

Hey Guys, I want to teleport the players to a different coordinate in a place, not the teleportservice. so is this the right way for me to do this or if I am wrong, help me correct it

Take a look at this script ( you can modify it to correct it ):

local debouncetwo = false
local BadgeService = game:GetService("BadgeService")
local p = game.Players:GetChildren()

BadgeId = 2124681279

while debouncetwo == false do
	wait(0.01)
	if game.Workspace.Boss.Humanoid.Health < 1 then
		game.ReplicatedStorage.Events.BossDefeated:FireAllClients(game.Players.LocalPlayer)
		for _, player in pairs(game.Players:GetPlayers()) do
			BadgeService:AwardBadge(player.UserId, BadgeId)
		end
		debouncetwo = true
		wait(62)
		for i = 1, #p do -- this is the part where i want to move all players to the teleport location
			p[i].Character:MoveTo(Vector3.new(433, 8.5, 157.5)) --Edit teleport location here
		end
	end
end

The Character is a model, and model doesn’t have the :MoveTo function. If you want them to animate and make them walk to a specific location, use their Humanoid instead. Otherwise, refer their PrimaryPart and set it’s newly desired position.

no, i just want to just teleport them instantly without animating.

Set their HumanoidRootPart CFrame to a position

local pos = CFrame.new(433, 8.5, 157.5)--Edit teleport location here

local debouncetwo = false
local BadgeService = game:GetService("BadgeService")
local p = game.Players:GetChildren()

BadgeId = 2124681279

while debouncetwo == false do
	wait(0.01)
	if game.Workspace.Boss.Humanoid.Health < 1 then
		game.ReplicatedStorage.Events.BossDefeated:FireAllClients(game.Players.LocalPlayer)
		for _, player in pairs(game.Players:GetPlayers()) do
			BadgeService:AwardBadge(player.UserId, BadgeId)
		end
		debouncetwo = true
		wait(62)
		for i = 1, #p do -- this is the part where i want to move all players to the teleport location
			p[i].Character:SetPrimaryPartCFrame(pos)
		end
	end
end

this should work i tried it myself

1 Like

That kind of for loop is for tables and the players service is not a table, to return a table of instances use :GetChildren()

So can’t they just do this:

p[i].Character.HumanoidRootPart.CFrame = CFrame.new(433, 8.5, 157.5)