How could I add to X, Y, or Z?

Hey everyone,

I made this script that adds to the Y/X/Z value but it just errors with this:
image
This also occurs when using CFrame (I am using position)

Is there another way I could do this or no?

1 Like

Depends on how you’re assigning the value, could we see the script? :thinking:

I’m not gonna bother with the DevForum code formatting:
image

script.Parent.MouseButton1Down:Connect(function()
    game.Workspace.CamPart.CFrame += CFrame.new(0, 1, 0)
end)

Ok, I edited mines. Idk if it’ll work.

Does the same thing in the output.

image

script.Parent.MouseButton1Down:Connect(function()
    game.Workspace.CamPart.CFrame *= CFrame.new(0, 1, 0)
end)

Ok changing the CFrame.new to Vector3.new worked! If you want it:

script.Parent.MouseButton1Down:Connect(function()
	workspace["Your Part Here"].CFrame += Vector3.new(0, 1, 0)
end)
script.Parent.MouseButton1Down:Connect(function()
    workspace.CamPart.CFrame.Position += Vector3.new(0, 1, 0)
end)

After briefly looking, it seems like you can only assign multiple coordinates & not just 1 individual coordinate at a time oop

Depends on uh which one helps you the most

1 Like

CFrame has a Y value, so you’re incorrect - CFrame.Y is totally valid. The problem is that it is read-only.

1 Like