How can I make all the accessories invisible when touching a block?

How can I make player accessories invisible when touching a block? pls i need his for complement an npc

1 Like

To do this, you need the Touched function and a detection of Humanoid only for all characters. Otherwise use Players:GetPlayerFromCharacter() for players only.

part.Touched:Connect(function(touched)
	local character = touched:FindFirstAncestorOfClass("Model")
	if not character then return end
	
	local player = game:GetService("Players"):GetPlayerFromCharacter(character) 
	if player then
		for _, object in pairs(character:GetChildren()) do
			if object:IsA("Accessory") then
				object.Handle.Transparency = 1
			end
		end
	end
end)
2 Likes

thanks man this help me a lot :smiley: