Set first person arms transparency back to transparent

  1. What do you want to achieve? Hello, i need to make the first person arms back to transparent after i turned them visible for something, i use this script to make the arms visible in first person :
local armsParts = {"LeftHand", "LeftLowerArm", "LeftUpperArm", "RightHand", "RightLowerArm", "RightUpperArm"}

for i, bodyPart in pairs(player.Character:GetChildren()) do
		if table.find(armsParts, bodyPart.Name) and bodyPart:IsA("BasePart") then
			bodyPart.LocalTransparencyModifier = bodyPart.Transparency
			bodyPart:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
				bodyPart.LocalTransparencyModifier = bodyPart.Transparency
			end)
		end
	end
  1. What is the issue? I can’t manage to make the first person arms transparent back again

  2. What solutions have you tried so far? I looked on forums and tried to fix it myself.

You can’t set the transparency back because of this code you wrote. Just remove this, since you don’t need it.

Who told you i don’t need it, when i equip my gun i want the arms to be visible and not visible when in unequip it

Can’t you just do something like

local children = player.Character:GetChildren()

for i,arm in pairs(children) do

if arm.Name == "RightHand" or arm.Name == "RightLowerArm" or arm.Name == "RightUpperArm" then
arm.Transparency = 1

end
end

I’m saying that the connection is causing the problem. It’s forcing the transparency to be the transparency of the part, forever.

You want this to happen when you ‘equip’ and ‘unequip’ the gun, or just when the camera is zoomed in to first person and zoomed out to third person?

Maybe instead of setting the modifier to the transparency of the part, set it to a variable, and use RunService to set the modifier every frame.

If it is for just equipping and unequipping a tool, you only need to check for the Equipped and Unequipped events.

https://create.roblox.com/docs/reference/engine/classes/Tool

local modifier = 0

game:GetService("RunService").RenderStepped:Connect(function(dt)
	for _, obj in pairs(player.Character:GetChildren()) do
		if obj:IsA("BasePart") then
			obj.LocalTransparencyModifier = modifier
		end
	end
end)

local function show() -- turn back to Visible
	modifier = 0
end

local function hide() -- turn back to Transparent/Invisible
	modifier = 1
end

hide()