Ive got this script but i want it to only affect the head but this affects the whole body is there anything i can do? (I want it to only be on when zoomed in also its used in a morph using custom hats not accesories)
local Game = game
local Workspace = workspace
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:FindFirstChild("Head") or Character:WaitForChild("Head")
local Camera = Workspace.CurrentCamera
local function OnRenderStep()
local Distance = (Camera.CFrame.Position - Head.Position).Magnitude
for _, Descendant in ipairs(Character:GetDescendants()) do
if not (Descendant:IsA("BasePart")) then continue end
Descendant.Transparency = 1 - ((Distance - 0.5) / 127.5)
end
end
RunService.RenderStepped:Connect(OnRenderStep)