Hi all, extremely new developer here and I have what is almost definitely an easy problem I was hoping someone can help with.
I’m creating a teleporter script that moves a player from one side of the map to the other. It’s a large wall so I want to keep the Y and Z coordinates of the character and only change their X coordinate. I cannot find the proper syntax to make it work. Here is what I have right now.
local character = player.Character
local rootPart = character:FindFirstChild("HumanoidRootPart")
local rootPos = rootPart.CFrame.Position
rootPos = Vector3.new(-370.5, rootPos.Y, rootPos.Z)
In your script, you’re creating a variable by doing this:
You modify rootPos, your variable later in the script. Unlike some other value types, CFrame and Vector3 are not referenced but are, instead, copied when you create a local variable. You also cannot modify a Vector3 inside of a CFrame. The code would need to be: