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
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)
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)
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)
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)