(in this image, the black lines represent the part and the gray lines the frame, on the left is what I have and on the right is the expected output)
Here’s my code:
function module:BindFrameToPart(object: GuiObject, proprieties: {})
local folder = game.Workspace:FindFirstChild("_RFT.uiparts")
if not folder then
folder = Instance.new("Folder", game.Workspace)
folder.Name = "_RFT.uiparts"
end
local transparency = proprieties["Transparency"] or 0.98
local brickColor = proprieties["BrickColor"] or BrickColor.new("Institutional white")
local part = Instance.new("Part", folder)
part.Name = object.Name
part.Transparency = transparency
part.BrickColor = brickColor
part.Anchored = true
part.CanCollide = false
game["Run Service"].RenderStepped:Connect(function()
part.CFrame = game.Workspace.CurrentCamera.CFrame + (game.Workspace.CurrentCamera.CFrame.LookVector * 5)
end)
end
Edit: the “object” is located inside another Frame, making it’s size adapt to the other Frame. I believe I need to somehow find the actual size of the object in order to properly size the part.
Edit 2: the Part is way too big, but it has the shape.
If you make a part that size and then CFrame it so that it’s offset from the camera by forwardOffsetDistance , I believe it should cover the entire screen.
I believe you also need to CFrame it with the forwardOffsetDistance.