Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I disable transparent body when you zoom in?

[insert title here]

and my game is literally all first person. so, yeah. I have no clue what to write

warn("No clue man none")

3 answers

✓ Accepted answer

This should work for R6 and R15 (Put in Global StarterGui):

--//Variables\\--
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

--//Events\\--
game:GetService("RunService").RenderStepped:Connect(function()
	--//Visible Limb\\--
	for i, part in pairs(character:GetChildren()) do
		if string.match(part.Name,"Arm") or string.match(part.Name,"Hand") or string.match(part.Name, "Leg") then
			part.LocalTransparencyModifier = 0
		end
	end
end)

Alright since I'm feeling nice here's a localscript that explains it. Place this in StarterGui

local self,player = script.Parent,game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
 local humanoid = char:WaitForChild("Humanoid") -- Waits for a Humanoid in a character



function antiTrans(part)
    if part and part:IsA("BasePart") and( part.Name=="LeftUpperArm"  or part.Name=="LeftLowerArm" or part.Name=="LeftHand" or part.Name=="RightUpperArm" or part.Name=="RightLowerArm" or part.Name=="RightHand" then -- Checks if the body part is a part and a arm
        part.LocalTransparencyModifier = part.Transparency
        part.Changed:connect(function (property)    
            part.LocalTransparencyModifier = part.Transparency --Makes the bodypart transparent
        end)
    end
end

for _,v in pairs(char:GetChildren()) do
    antiTrans(v) --Gets all the bodyparts in localplayer's character as an array and connects to a function
end

This script is for R15 though, I do not have a R6 script. You may edit the script to add your own body parts but the names must match and is case sensitive.

LocalTransparencyModifier

You want to loop through all the parts inside the character that you want visible and change their LocalTransparencyModifier. When I last used this, the game engine forced the player to become transparent so you have to use RunService.RenderStepped to change the transparency every frame.

I don't know how things have changed so you should try it without to see if it works.

local character = LocalPlayer.Character

local function makeInvisible()
	for _, obj in next, character:GetDescendants() do
		--get all objects inside character and loops through them
		if (obj) and (obj:IsA("BasePart")) then
			--check if it exists and is a part
			obj.LocalTransparencyModifier = 0
			--make part visible
		end
	end
end

game:GetService("RunService").RenderStepped:Connect(function()
	--fires every time your frame is rendered
	makeInvisible()
	--makes sure every frame has the parts visible
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.