[ABANDONED] Attach To Camera Module | V1.0.0

[Gave up on it because it was useless, just realized this was easy to do. you can still get the module but don’t expect any updates on this]

Attach To Camera module !

What is this module ?

This module is a simple module that attaches a part of your choice into the camera !

How does it work ?

little model of how the module works


XOffset and YOffset determines the position of the part according to the screen
ZOffset determines the depth of the part according to the screen

NOTE : XOffset and YOffset values needs to be lower than the ZValue or else it will go offscreen
It also only works on localscripts or scripts with a RunContext of Client
Also, when attaching a part, if it is in a different parent than workspace, you don’t need to set the parent to workspace since the script is automatically parenting the part to the Camera
SCRIPTS :
Attach a part to the screen :

module.AttachObject(obj, XOffset, YOffset, ZOffset, followType)
--followTypes : StaticFollow, AlignOrientationFollow

Detach the part from the screen :

module.DetachObject(obj)

Get a list of every part attached to the screen :

module.GetAttachObjects()
Handled exceptions :
  • Error 1 : Error: All parameters must be provided.
    It means that not everything has been provided and the script can’t process it so it crashes
  • Error 2 : Error: The instance must be a BasePart, MeshPart, or UnionOperation.
    It means that the type of instance you provided is not supported by the module
  • Error 3 : Error : The selected object is not found in the camera. OR [path] is not a valid parent of Workspace.Camera
    It means that no such attached part has been found

Let me know if there is errors not shown in this list

Get the module :

You can get the module here !

Opinions about this module ?
  • Nice one !
  • Could have some improvements but it’s a great one
  • Meh…
  • This module is bad
  • you just created an abomination…

0 voters

1 Like

What’s the use for this, I see no cases where I could use this.

1 Like

From the looks of it, I believe this just attaches a BasePart onto your camera, like a view model.

The module does exactly as intended and I think it’s a nice resource for beginners.
I don’t think this was intended for intermediate/advanced scripters.

1 Like

It has a few (1-2) notable features but to be honest there’s absolutely no point in anyone using this because 1; you can easily do it yourself 2; even if it is intended for beginners, this would actually make their life a lot harder in the long run since they would have to learn how the camera works in depth from the beginning to code custom behavior.

(TO OP) Thanks for your contribution anyways, but your resource isn’t really useful.

1 Like
local offset = Vector3.new(0,0,0)

game:getService("RunService").RenderStepped:Connect(Function()
    Viewmodel:PivotTo(workspace.CurrentCamera.CFrame * CFrame.new(offset))
end)
1 Like
local RunService = game:GetService("RunService")

local Camera = workspace.CurrentCamera
local Offset = CFrame.new(Vector3.zero)
local Viewmodel : BasePart = nil -- add your viewmodel here

RunService:BindToRenderStep("UpdateCamera", Enum.RenderPriority.Camera.Value, function()
	Viewmodel.CFrame = Camera.CFrame * Offset
end)
1 Like