An absolutely infuriating issue with part transparency

I’ve been working on this issue for hours now and it’s extremely demoralizing :frowning_face:

This script makes it so players are invisible to each other.

local hide = true
local function checkPart(part) 
	for a,b in pairs(part:GetChildren()) do 
		checkPart(b)
	end
	if part:IsA("BasePart") or part:IsA("Decal") then
		if hide == true then
			part.Transparency = 1
		end
		if hide == false then
			if part.Name ~= "HumanoidRootPart" then
				part.Transparency = 1
			else
				part.Transparency = 0
			end
		end
	end
end

local players = game:GetService("Players")
local localPlayer = players.LocalPlayer

function checkPartChar()
	for i,v in pairs(players:GetPlayers()) do
		if v ~= localPlayer then
			local char = v.Character
			if char then
				checkPart(char)
			end
		end
	end
end
game:GetService("RunService").RenderStepped:Connect(checkPartChar)

This code is part of a local script in StarterGui. It needs to be able to turn on and off. I have a separate piece of code that sets the hide variable to false and reruns the second function to check if hide is true or false.

This works miraculously, except for one thing. The HumanoidRootPart is still visible. Here is a picture of my friend standing in front of me;
f71ea47709c09e299faf2e6b870fd4a4

As you can see the big gray part in his chest is the HumanoidRootPart, and it is clearly visible. The HumanoidRootPart is only visible on other players, your own is not visible. Anyone know how to fix this?

Thanks

You’re checking if it’s not the HumanoidRootPart, and making it invisible. I don’t know what you expect to happen, but the script is doing exactly what you tell it to.

3 Likes

oh my god im an idiot

Thank you ;-;