Changing only one axis of position value

Hi, i have a script that get the position of the player in a variable and after this i want to modify the Y axis, so the high axis without modifing the other two values.

Thanks

Just use Part.Position.Y it should work fine

local humanoidRP = game.Workspace:WaitForChild(plr.Name).HumanoidRootPart
	print(humanoidRP.Position, "First Pos")
	humanoidRP.Position.Y += 50
	print(humanoidRP.Position, "Final Pos"

Doesn’t work
Error: Y cannot be assigned to

This would be the fixed script.

local humanoidRP = game.Workspace:WaitForChild(plr.Name).HumanoidRootPart
print(humanoidRP.Position, "First Pos")
humanoidRP.Position += Vector3.new(0, 50, 0)
print(humanoidRP.Position, "Final Pos")
1 Like

Yea but i Want to add 50 and not set the value to 50

That’s what the script is doing.

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