How can I change the players position to the position of a parts C frame

I’m not really sure what to say other than I don’t know how I’m going to do this.

I’m just trying to make it so after using a proximity prompt it moves the player to the Cframe of a part in workspace through a server script.

Here is my code, I have also annotated what I have tried:

local Part = script.Parent.Parent
local ProximityPrompt = script.Parent


ProximityPrompt.Triggered:connect(function(Player)
	local currency2 = Player:WaitForChild("leaderstats"):WaitForChild("Macopoly Tickets")
	if currency2.Value >= 20 then
		currency2.Value -= 20
		--Player.Character.Torso.Position = game.Workspace.TP.CFrame
		end
	end)

If you need additional information or if something doesn’t make sense, let me know.
Thanks!

Position is a Vector3 value, CFrame is different.

Player.Character.PrimaryPart.Position = game.Workspace.PrimaryPart.Position

or

Player.Character.PrimaryPart.CFrame = game.Workspace.TP.CFrame

I also suggest using PrimaryPart instead of Torso, since R15 characters dont have “Torso”. Even though it might not apply to this, it’s still a good practice :smiley:
(I think the PrimaryPart for all characters is “HumanoidRootPart”)

3 Likes