#1st person mechanism

1 messages · Page 1 of 1 (latest)

narrow maple
#

How would I make a part not show only when a player is in 1st person?

thorny valley
#

What do you mean ? Like a tool ?

narrow maple
thorny valley
#

Something like this ?

#

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local part = workspace.Part

RunService.RenderStepped:Connect(function()
    if not player.Character or not player.Character:FindFirstChild("Head") then return end
    
    local head = player.Character.Head
    local distance = (camera.CFrame.Position - head.Position).Magnitude

    if distance <= 0.5 then
        part.LocalTransparencyModifier = 1 
    else
        part.LocalTransparencyModifier = 0
    end
end)
#

This is local btw

narrow maple
#

I've never used LocalTransparencyModifier, I'll try

thorny valley
#

Alright, tell me if it work

thorny valley
#

I guess it does