Can't teleport humanoid root part?

I would like to make a simple script where it teleports a player to a part in the workspace, for some reason I cannot do it:


There are lots of other things in the script but the highlighted blue one is the one I am questioning, it simply does nothing with no errors.

Can anyone help? Thank you! :smiley:

1 Like

Set the HumanoidRootPart’s CFrame, not position, to the part’s CFrame.

So try:

hit.Parent.HumanoidRootPart.CFrame = game.Workspace.ArcadeTeleports.Teleport1.CFrame``

he set the position to CFrame.Position so it shouldn’t matter

I’m talking about the humanoid, not the part.

then it just returns a position, you can’t even assign anything to it

Still doesn’t work, I have teleported players like this many times before so I’m super confused.


Does anything here mess with it?

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0 , false)
local tweenGoals = {Size = Vector3.new(4.133, 3.1, 3.1)}
local effectPart = script.Parent.Parent.EffectPart
local size = effectPart.Size
used = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and used == false then
		used = true
		game.ReplicatedStorage.CameraChangeEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
		hit.Parent.HumanoidRootPart.CFrame = script.Parent.Parent.TeleportPart.CFrame
		hit.Parent:SetPrimaryPartCFrame(CFrame.new(hit.Parent.PrimaryPart.Position, effectPart.Position))
		hit.Parent.Humanoid.WalkSpeed = 0
		hit.Parent.Humanoid.JumpHeight = 0
		local tweenGoals2 = {CFrame = hit.Parent.HumanoidRootPart.CFrame * CFrame.Angles(-180,0,0)}
		--local tweenGoals3 = {CFrame = hit.Parent.HumanoidRootPart.CFrame + hit.Parent.HumanoidRootPart.CFrame.ZVector + 50 }
		effectPart.Attachment.ParticleEmitter.Enabled = true
		effectPart.Attachment.ParticleEmitter2.Enabled = true
		effectPart.Transparency = 0
		wait(.3)
		hit.Parent.HumanoidRootPart.Anchored = true
		local tween = tweenService:Create(effectPart, tweenInfo, tweenGoals)
		tween:Play()
		print("Arcade machine activated!")
		wait(7)
		local tween2 = tweenService:Create(hit.Parent.HumanoidRootPart, tweenInfo, tweenGoals2)
		local tween3 = tweenService:Create(hit.Parent.HumanoidRootPart, tweenInfo, {Position = workspace.ArcadeMachine.EffectPart.Position})
		tween2:Play()
		wait(4)
		tween3:Play()
		wait(3)
		hit.Parent.Humanoid.WalkSpeed = 16
		hit.Parent.Humanoid.JumpHeight = 7.5
		hit.Parent.HumanoidRootPart.Anchored = false
		hit.Parent.HumanoidRootPart.CFrame = game.Workspace.ArcadeTeleports.Teleport1.CFrame
		game.ReplicatedStorage.CameraChangeBackEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
		--effectPart.Transparency = 1
		effectPart.Size = size
		effectPart.Attachment.ParticleEmitter.Enabled = false
		effectPart.Attachment.ParticleEmitter2.Enabled = false
	end
end)

Here is the text if that is easier.

Hello @staffles

I saw this part on your code.

hit.Parent:SetPrimaryPartCFrame(CFrame.new(hit.Parent.PrimaryPart.Position, effectPart.Position))

If I’m not mistaken I think you should change the position words to CFrame because you setting the primary part CFrame.

Try referencing the character and do Character:SetPrimaryPartCFrame( Put the CFrame here ) and in those parameters put the CFrame of the part you’re trying to teleport the player to

Did what you said, and what @EducatedPilot04 said. New script:

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0 , false)
local tweenGoals = {Size = Vector3.new(4.133, 3.1, 3.1)}
local effectPart = script.Parent.Parent.EffectPart
local size = effectPart.Size
used = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and used == false then
		used = true
		game.ReplicatedStorage.CameraChangeEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
		hit.Parent.HumanoidRootPart.Position = script.Parent.Parent.TeleportPart.Position
		hit.Parent:SetPrimaryPartCFrame(CFrame.new(hit.Parent.PrimaryPart.CFrame.Position, effectPart.CFrame.Position))
		hit.Parent.Humanoid.WalkSpeed = 0
		hit.Parent.Humanoid.JumpHeight = 0
		local tweenGoals2 = {CFrame = hit.Parent.HumanoidRootPart.CFrame * CFrame.Angles(-180,0,0)}
		--local tweenGoals3 = {CFrame = hit.Parent.HumanoidRootPart.CFrame + hit.Parent.HumanoidRootPart.CFrame.ZVector + 50 }
		effectPart.Attachment.ParticleEmitter.Enabled = true
		effectPart.Attachment.ParticleEmitter2.Enabled = true
		effectPart.Transparency = 0
		wait(.3)
		hit.Parent.HumanoidRootPart.Anchored = true
		local tween = tweenService:Create(effectPart, tweenInfo, tweenGoals)
		tween:Play()
		print("Arcade machine activated!")
		wait(7)
		local tween2 = tweenService:Create(hit.Parent.HumanoidRootPart, tweenInfo, tweenGoals2)
		local tween3 = tweenService:Create(hit.Parent.HumanoidRootPart, tweenInfo, {Position = workspace.ArcadeMachine.EffectPart.Position})
		tween2:Play()
		wait(4)
		tween3:Play()
		wait(3)
		print("ss")
		hit.Parent.Humanoid.WalkSpeed = 16
		hit.Parent.Humanoid.JumpHeight = 7.5
		hit.Parent.HumanoidRootPart.Anchored = false
		hit.Parent:SetPrimaryPartCFrame(game.Workspace.ArcadeTeleports.Teleport1.CFrame)
		--hit.Parent.HumanoidRootPart.Position = game.Workspace.ArcadeTeleports.Teleport1.Position
		game.ReplicatedStorage.CameraChangeBackEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
		--effectPart.Transparency = 1
		effectPart.Size = size
		effectPart.Attachment.ParticleEmitter.Enabled = false
		effectPart.Attachment.ParticleEmitter2.Enabled = false
	end
end)

Still has the same issue, no errors it just doesn’t do anything. I made it print something to make sure it was actually running the line of code and it did print.

@staffles srry late reply.I have read your script and I’m kinda confuse about this line

hit.Parent:SetPrimaryPartCFrame(CFrame.new(hit.Parent.PrimaryPart.CFrame.Position, effectPart.CFrame.Position))

Try change it to this.Im sorry if Im wrong Im still learning

hit.Parent:SetPrimaryPartCFrame(CFrame.new(hit.Parent.PrimaryPart.CFrame, effectPart.CFrame))