Issue with making players visible

Hey there, so I have made a script that makes other players invisible during an animation cutscene it all works and all but once I make the player Visible after its played there is a random white part on the player’s torso.

What do I have to do to get rid of that?

grafik

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

-- MAKES PLAYER INVISIBLE
local function MakeInvisible(character)
	for _, part in ipairs(character:GetDescendants()) do
		if part:IsA("BasePart") or part:IsA("Decal") or part:IsA("Acessory") then
			part.Transparency = 1
		end
	end
end

-- MAKES PLAYER VISIBLE AGAIN
local function MakeVisible(character)
	for _, part in ipairs(character:GetDescendants()) do
		if part:IsA("BasePart") or part:IsA("Decal") or part:IsA("Acessory") then
			part.Transparency = 0
		end
	end
end

-- ASYLUM ENTRY START
local amt = game.Workspace.AnimationPartTrigger

amt.Touched:Connect(function(otherPart)
	local character = localPlayer.Character
	if character then
		for _, otherPlayer in pairs(Players:GetPlayers()) do
			if otherPlayer ~= localPlayer then
				local otherCharacter = otherPlayer.Character
				if otherCharacter then
					MakeInvisible(otherCharacter)
				end
			end
		end
	end
end)

-- ASYLUM ENTRY END
local telepart = game.Workspace.TeleportPart

telepart.Touched:Connect(function(otherPart)
	local character = localPlayer.Character
	if character then
		for _, otherPlayer in pairs(Players:GetPlayers()) do
			if otherPlayer ~= localPlayer then
				local otherCharacter = otherPlayer.Character
				if otherCharacter then
					MakeVisible(otherCharacter)
				end
			end
		end
	end
end)

oh its the humanoidrootpart, when u make the bodyparts visible again, just add

and part ~= character.PrimaryPart
2 Likes

Sorry for late response but it worked, thank you so much!!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.