Teleporting players doesnt work

Simple as it is, i cant manage to teleport the player that i want to
I used a print and yes my script works propely

I tried all of theses variants without successing

`HumanoidRootPart.CFrame = TpPart.CFrame
HumanoidRootPart.CFrame = CFrame.new(-28, 4.5, -15)
HumanoidRootPart.Position = TpPart.Position
`

Instead of changing the CFrame of the player, try using :PivotTo on the player’s model. It takes a CFrame as the parameter, and you can get the pivot of another model using :GetPivot()

Character:PivotTo(tpPart.CFrame)
1 Like

Its still not working the issue is probably not from the line that teleport the player i guess

1 Like

Any errors? are you certain that the lines of code are running?

1 Like

100% sure

image
image

1 Like

Are you redefining the Character model when the player dies?

1 Like

Yes i do

llllllllllllllllllllll

1 Like

Try adding another delay after the CharacterAdded:Wait(), to see if it helps

Alternatively, replace Character with Player.Character to test my hypothesis

1 Like

This is sadly not working

image

1 Like

Maybe it could be something with your code?

1 Like

its a 200 lines script feel free to choose if you want to analyze it or not

`local Event1 = game.ReplicatedStorage.RemotesEvents.CompetencesEquipeBleu
local TpPart = game.Workspace.Zone.TpPart
local PartBleu = game.Workspace.Equipes.PartBleu
local PartRouge = game.Workspace.Equipes.PartRouge
local BillboardGui = game.Workspace.Zone.Affichage.BillboardGui.TextLabel

local PrisoniersTable = {}
local JoueursEquipeRouge = {}

Event1.OnServerEvent:Connect(function(Player)

local HumanoidRootPart = Player.Character:FindFirstChild("HumanoidRootPart")


local Hitbox = Instance.new("Part", workspace)
Hitbox.CFrame = HumanoidRootPart.CFrame * CFrame.new(0, 0, -1)
Hitbox.Size = Vector3.new(8,8,8)
Hitbox.CanCollide = false
Hitbox.Transparency = 0


local Woosh = Instance.new("Sound", HumanoidRootPart)
Woosh.SoundId = "rbxassetid://9041161094"
Woosh.Volume = 0.1
Woosh:Play()


local WeldConstraint = Instance.new("WeldConstraint", Hitbox)
WeldConstraint.Part0 = HumanoidRootPart
WeldConstraint.Part1 = Hitbox


Hitbox.Touched:Connect(function(Hit)
	if Hit.Parent:FindFirstChild("Humanoid") then	
	
	
	print(Hit.Parent)
	local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
	local EquipeBleuBool = Player.Valeurs.EquipeBleuBool
	local PrisonierBool = Player.Valeurs.PrisonierBool



		if EquipeBleuBool.Value == false then
		if not table.find(PrisoniersTable, Player.Name) then
	
	
	
		local VictimeHumanoidRootPart = Hit.Parent:FindFirstChild("HumanoidRootPart")
		local VictimeHumanoid = Hit.Parent:FindFirstChild("Humanoid")
		
		
		
		for _,v in pairs(game.Players:GetChildren()) do
			if v.Valeurs.EquipeBleuBool.Value == false then
				if not table.find(JoueursEquipeRouge, v.Name) then
				table.insert(JoueursEquipeRouge, v.Name)
				end
			end
		end
		
		
		PrisonierBool.Value = true
		table.insert(PrisoniersTable, Player.Name)
		BillboardGui.Text = (#PrisoniersTable .. "/" .. #JoueursEquipeRouge)
		
		
		

		VictimeHumanoidRootPart.CFrame = TpPart.CFrame
		VictimeHumanoid.WalkSpeed = 16
		
		
		local Sifflement = Instance.new("Sound", HumanoidRootPart)
		Sifflement.SoundId = "rbxassetid://9117259635"
		Sifflement.Volume = 0.05
		Sifflement:Play()
end		
end
end
end)

wait(0.1)

Hitbox:Destroy()

end)

game.Players.PlayerRemoving:Connect(function(Player)

if table.find(JoueursEquipeRouge, Player.Name) then


table.remove(PrisoniersTable, table.find(PrisoniersTable, Player.Name))
table.remove(JoueursEquipeRouge, table.find(JoueursEquipeRouge, Player.Name))
print(#JoueursEquipeRouge)
BillboardGui.Text = (#PrisoniersTable .. "/" .. #JoueursEquipeRouge)

end
end)

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()

	local EquipeBleuBool = Player.Valeurs.EquipeBleuBool
	

	if not table.find(JoueursEquipeRouge, Player.Name) then
	if EquipeBleuBool.Value == false then
	
	
	table.insert(JoueursEquipeRouge, Player.Name)
	BillboardGui.Text = (#PrisoniersTable .. "/" .. #JoueursEquipeRouge)
	
	
	
	local Humanoid = Player.Character:FindFirstChild("Humanoid")
	local HumanoidRootPart = Player.Character:FindFirstChild("HumanoidRootPart")
	local Character = Player.Character
	
	

	
	
	
			for _,Corp in pairs(Player.Character:GetChildren()) do	
				if Corp:IsA("Part") or Corp:IsA("BasePart") then

					Corp.Touched:Connect(function(Hit)
						if Hit.Parent:FindFirstChild("Humanoid") then

							local Player1 = game.Players:GetPlayerFromCharacter(Hit.Parent)
							local Character = Player1.Character
							local HumanoidRootPart = Player1.Character:FindFirstChild("HumanoidRootPart")
							local Humanoid = Player1.Character:FindFirstChild("Humanoid")
							local PrisonierBool = Player1.Valeurs.PrisonierBool
							
							if Player1.Name ~= Player.Name then
							if PrisonierBool.Value == true then
								if EquipeBleuBool.Value == false then
									
									table.remove(PrisoniersTable, table.find(PrisoniersTable, Player1.Name))
									BillboardGui.Text = (#PrisoniersTable .. "/" .. #JoueursEquipeRouge)
									
									Humanoid.WalkSpeed = 25
									
									
									
								end
								end
								end
						end
					end)
				end
				end
							
							
							
							
							
	
	Humanoid.Died:Connect(function()
		if table.find(PrisoniersTable, Player.Name) then
			local Character = Player.Character
			local HumanoidRootPart = Player.Character:FindFirstChild("HumanoidRootPart")
			
			
			print(Player.Name .. " tried to run away")
			
			Player.CharacterAdded:Wait()
			
			wait(3)
			
			Player.Character:PivotTo(TpPart.CFrame)
			
		end
	end)
end
end
end)

end)

PartBleu.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild(“Humanoid”) then

	local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
	
	if table.find(JoueursEquipeRouge, Player.Name) then
	
	table.remove(JoueursEquipeRouge, table.find(JoueursEquipeRouge, Player.Name))
	BillboardGui.Text = (#PrisoniersTable .. "/" .. #JoueursEquipeRouge)
	
	end
end

end)

PartRouge.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild(“Humanoid”) then

	local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)

	if not table.find(JoueursEquipeRouge, Player.Name) then

		table.insert(JoueursEquipeRouge, Player.Name)
		BillboardGui.Text = (#PrisoniersTable .. "/" .. #JoueursEquipeRouge)

	end
end

end)`

1 Like
        local Character = Player.Character
		local HumanoidRootPart = Player.Character:FindFirstChild("HumanoidRootPart")
		
		
		print(Player.Name .. " tried to run away")
		
		Player.CharacterAdded:Wait()
		
		wait(3)
		
		Player.Character:PivotTo(TpPart.CFrame)

change this to this and tell me if it works or not

		print(Player.Name .. " tried to run away")
		
		Player.CharacterAdded:Wait()
		
		wait(3)

        local Character = Player.Character
		local HumanoidRootPart = Player.Character:FindFirstChild("HumanoidRootPart")
		
		Player.Character:PivotTo(TpPart.CFrame)
2 Likes

I didnt think it would but, it works thank you

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.