I want a part to be rendered in front of the camera and I’m using BindToRenderStep to achieve this, but I have an issue where the part would not be visible at some points:
Code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Value = Player:WaitForChild("PlayerInfo"):WaitForChild("Values").Seeker
local Part = ReplicatedStorage.RenderPart:Clone()
local Name = "RenderFrame"
local Distance = 2
Part.Name = "BlackFramePart"
Part.Parent = workspace.CurrentCamera
function render()
Part.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(0,0,Distance)
end
Value:GetPropertyChangedSignal("Value"):Connect(function()
if Value.Value == false then
RunService:UnbindFromRenderStep(Name)
Part.Position = Vector3.new(0,-50,0)
else
RunService:BindToRenderStep(Name,Enum.RenderPriority.Camera.Value,render)
end
end)
RunService:BindToRenderStep(Name,Enum.RenderPriority.Camera.Value,render)
And this is how the part looks like:
I believe it’s because the angle is not right but I don’t really know how to fix it. Any idea?
