I made a script for first person so u can see ur body but the camera offset lets u see through walls. Anyone got any ideas for solutions? Without the offset it looks rlly bad.
--// Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
--// Variables
local plr = Players.LocalPlayer
local camera = workspace.CurrentCamera
plr.CameraMode = Enum.CameraMode.LockFirstPerson
local function setupCharacter(character)
-- Adjust CameraOffset
local humanoid = character:WaitForChild("Humanoid")
humanoid.CameraOffset = Vector3.new(0, 0, -1)
-- Apply transparency every frame
RunService.RenderStepped:Connect(function()
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") and v.Name ~= "Head" then
v.LocalTransparencyModifier = 0
elseif v:IsA("BasePart") and v.Name == "Head" then
v.LocalTransparencyModifier = 1 -- hide head
end
end
end)
end
-- Initial character
setupCharacter(plr.Character or plr.CharacterAdded:Wait())
-- Reapply on respawn
plr.CharacterAdded:Connect(function(char)
setupCharacter(char)
end)