Make first person arms invisible when a certain tool is equipped

Title says it all, i just wanna make the arms invisible again whenever a special tool is equipped.
The script i am using is from: Make arms visible in first person - #4 by SpiralAPI
I have tried to put a check on the for loop but it doesn’t work.
I even tried disabling the script through Tool.Equipped but that didn’t work either.

for _,parts in pairs(char:GetChildren()) do
    if parts.Name == "Pistol" then return end
    VisibleArms(parts) -- arms are visible on first person view
end

you can do it by using the equipped event in your local script. [should be parented to the tool]

Just edited my post to mention that i tried that. It did not work regardless.

could i see the code that you tried with the equipped event? cause it should work.

also wdym by disabling the sccript through tool.equipped

Tool.Equipped:Connect(function()
LocalPlayer.PlayerGui:FindFirstChild("Arms").Enabled = false
end)

does arms exists in playergui anyways?

Yes it does, it’s a localscript. (It’s reparented to playergui)

Bump: i tried doing this function but it doesn’t work any ideas?

Tool.Equipped:Connect(function()
	for _,v in ipairs(Character:GetChildren()) do
		if string.match(v.Name, "Arm") then
			v.LocalTransparencyModifier = 1
		end
	end
end)

how did you check in the for loop?

Since the tool is parented to the player model while equipped instead of using GetPlayerFromCharacter you could directly get the parts (assuming the script is in the tool itself) using script.Parent.Parent. So something like this.

local char = script.Parent.Parent
Tool.Equipped:Connect(function()
     if char.Humanoid ~= nil then
          if char.Humanoid.RigType == "R15" then
               char.LeftHand.Transparency = 1
               char.LeftLowerArm.Transparency = 1
               char.LeftUpperArm.Transparency = 1
               char.RightHand.Transparency = 1
               char.RightLowerArm.Transparency = 1
               char.RightUpperArm.Transparency = 1
           else --We're R6!--
               char.RightArm.Transparency = 1
               char.LeftArm.Transparency = 1
          end
     end
end)

That works… but it makes the arms also invisible in third person, should i use LocalTransparencyModifier instead?
Nvm tried that and didnt work either
image

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:WaitForChild("Head")
local Camera = Workspace.CurrentCamera

local function OnRenderStep()
	local Distance = (Camera.CFrame.Position - Head.Position).Magnitude
	local State = (Distance < 1)
	local Item = Character:FindFirstChildOfClass("Tool")
	for _, Descendant in ipairs(Character:GetChildren()) do
		if string.find(Descendant.Name, "Arm$") or string.find(Descendant.Name, "Hand$") then
			if Descendant:IsA("BasePart") then
				Descendant.LocalTransparencyModifier = if (State and Item) then 0 elseif State then 0.5 else 0
			end
		end
	end
end

RunService.RenderStepped:Connect(OnRenderStep)

SwordVisibleArms.rbxl (35.1 KB)

4 Likes

This works it detects if player is holding a tool and increases the transparency however is it there any way to make Item ignore a tool with a certain name? (like Axe)? (Basically make the arms invisible again when the character equips Axe)

if (State and Item and Item.Name ~= "Axe") then 0
4 Likes

for me that’s making the arms visible and not invisible. It also messes up my first person body script (basically makes it so it doesn’t work).