#Trying to make a seperately rendered model for the local player

1 messages · Page 1 of 1 (latest)

late smelt
#

Im trying to seperately render this freddy nose on the local players screen using VPFs. This is because I dont want the camera to be able to see the nose clipping through walls. Essentially the effect that FPS games use to avoid guns clipping through walls and objects. Though, the problem is I need it to render relative to the worlds lighting & shadows so it looks real. I am trying to replicate that by moving the VPFs reference model to where it is displayed by it to the player. I'm thinking this will allow the nose to pick up all the lighting and shadows around it to display on the VPF's projection.

#

here is it not being placed inside the vpf, to show it is staying on the players head. I do plan to add a camera to the VPF to make it look correct

late smelt
# late smelt Im trying to seperately render this freddy nose on the local players screen usin...

here is the script handling this

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local nose = game.ReplicatedStorage.Nose
local newNose = nose:Clone()

local folder = workspace.temp

game:GetService("RunService").RenderStepped:Connect(function()
    
    local characterPos = character:WaitForChild("Head").CFrame
    local nosePivot = newNose:GetPivot()
    newNose:PivotTo(characterPos * CFrame.new(0,0,-1))
    newNose.Parent = folder
    
    if #folder:WaitForChild("Nose"):GetChildren() < 1 then
        for i, v in nose:GetChildren() do
            local clonedPart = v:Clone()
            clonedPart.Parent = folder.Nose
        end
    end
    newNose.PrimaryPart = newNose.primary
end)