Viewport's position for a plugin not working

  1. What do you want to achieve?
    So I’m making a plugin and I want to be able to create a part in front of the user is facing (eg. their viewport)

  2. What is the issue?
    I cannot get it working and I have no idea what the issue is.

  3. What solutions have you tried so far?
    I’ve looked at some other posts, which is where I got this from. Yet, it still doesn’t work.

CFrame.new(workspace.CurrentCamera.Position + workspace.CurrentCamera.CFrame.LookVector * 10)
1 Like

can it be that when you click it spawns where you click if yes use mouse.p

1 Like

Camera objects do not have a Position property, they only have a CFrame property
You can extract the position from the CFrame doing the following:

workspace.CurrentCamera.CFrame.Position

Resulting in the final script of:

CFrame.new(workspace.CurrentCamera.CFrame.Position + workspace.CurrentCamera.CFrame.LookVector * 10
2 Likes