#How to set parts visible on player first person

1 messages · Page 1 of 1 (latest)

minor quarry
#

hey, how do I forcefully set a part to visible in first person?
I've already tried this script but it doesn't work

setPartsVisible.OnClientEvent:Connect(function()
    local rChar = plr.Character or plr.CharacterAdded:Wait()

    repeat task.wait() until rChar:FindFirstChildWhichIsA("BasePart")
    
    task.wait(0.5)
    
    for _, part : BasePart in rChar:GetChildren() do
        if part.Name:find("Tenticle") then 
            part.LocalTransparencyModifier = 0 
            part.Transparency = 0 
            part.CastShadow = true
            part.CanQuery = true
        end
    end
end)

I also tried overriding roblox's default camera module to not account for the part that I want and it also doesn't work

local camScript = plr.PlayerScripts:WaitForChild("PlayerModule"):WaitForChild("CameraModule")
camScript:Destroy()

local customCamScript = script:WaitForChild("CameraModule"):Clone()
customCamScript.Parent = plr.PlayerScripts.PlayerModule
function TransparencyController:IsValidPartToModify(part: BasePart)
    if FFlagUserHideCharacterParticlesInFirstPerson then
        for _, className in HIDE_IN_FIRST_PERSON_CLASSES do
            if part:IsA(className) and not part.Name:find("Tenticle") then
                return not self:HasToolAncestor(part)
            end
        end
    else
        if part:IsA('BasePart') or part:IsA('Decal') then
            return not self:HasToolAncestor(part)
        end
    end
    return false
end

Tenticle is not a typo btw

minor quarry
#

I've tested more things and found out that this script works for normal characters:

local function setTentaclesVisible()
    local char = player.Character or player.CharacterAdded:Wait()
    local head = char:WaitForChild("Head")
    
    local cTable = char:GetChildren()

    for i, v in pairs(char:GetChildren()) do
        if v:IsA("BasePart") and v.Name ~= "Head" then

            v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
                v.LocalTransparencyModifier = v.Transparency
            end)

            v.LocalTransparencyModifier = v.Transparency

        end
    end

    RunService.PreRender:Connect(function()
        local params = RaycastParams.new()
        params.FilterType = Enum.RaycastFilterType.Exclude
        params.FilterDescendantsInstances = cTable

        local ray = workspace:Raycast(head.Position, ((head.CFrame + head.CFrame.LookVector * 2) - head.Position).Position.Unit, params)

        if ray then
            char.Humanoid.CameraOffset = Vector3.new(0, 0, -(head.Position - ray.Position).Magnitude)
        else
            char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
        end
    end)
end

it just doesn't work with the character model with the tentacles, I don't know why

#

this is the model btw

misty shuttle
#

💔

minor quarry
fluid spindle
#

bro im jk

#

you tried transparency right

minor quarry
#

sigh

#
for i, v in pairs(char:GetChildren()) do
        if v:IsA("BasePart") and v.Name ~= "Head" then

            v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
                v.LocalTransparencyModifier = v.Transparency
            end)

            v.LocalTransparencyModifier = v.Transparency

        end
    end
#

yes

#

as I've said, this works for normal characters

#

it doesn't work for the specific model I've provided

minor quarry
#

actually found out that the reason for it malfunctioning was because I was receiving the remote event on a local script under player character scripts