Player to teleport to CFrame position

I am trying to make the player teleport to a certain position but I do not understand what’s going wrong, this is the error.
image

Here is the line.

HumRoot.CFrame = CFrame.new(15, 15, 15)

Post the whole code or at least a little bit more up to where “HumRoot” is defined

1 Like

Hi, so as CFrame is now replaced with position you will have to do HumRoot.Position = CFrame.new(15,15,15)

1 Like

No, the Position property takes a Vector3 value, not CFrame.

2 Likes

Yes then they would need to do HumRoot.Position = Vector3.new(15,15,15)

1 Like

wait shouldnt you just set the primary part’s cframe to CFrame.new(15,15,15)?

Yeah I agree with @heII_ish we need more to be able to help.

The HumRoot Variable is not defined. You need to make sure it is. That is what the error means.

local Character = Player.Character or Player.CharacterAdded:Wait()
local HumRoot = Character:WaitForChild("HumanoidRootPart")

Also for teleporting a player you might want to use

Character:SetPrimaryPartCFrame(CFrame.new(15,15,15))

Instead as Roblox reccommends you do it that way.

2 Likes

There are actually two problems here:

  1. HumRoot is nil. I can’t really solve this since I don’t know how your code works but I’m guessing you did not define HumRoot or you did define it but it got destroyed/replaced.
  2. You need to insert Vector3 into CFrame.new like this:
    CFrame.new(Vector3.new(15, 15, 15))

Edit: My bad, you can build a CFrame with 3 numbers. So, only 1 problem.

@jaidon11 error is saying that HumRoot is nil. make sure HumRoot isn’t nil. may i see what is HumRoot?

The second point is false, you can make CFrame with three numbers. The CFrame constructor is heavily overloaded.

1 Like