Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i make accesories transparent?

I have this code that will make semi-invisible all limbs of a bod, but no accesories (hair, hats, etc) i know that i have to make it with the handle since its impossible to turn an accesory invisible but how could i add it to this script?

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        Character.Archivable = true        

        while wait(0.1) do
	        local clonedCharacter = Character:Clone()
            clonedCharacter.Parent = game.Workspace
            local delete = clonedCharacter:FindFirstChild("HumanoidRootPart")
            local Parts = clonedCharacter:GetChildren()
            for i = 1, #Parts do
            if Parts[i]:IsA("BasePart") then 
            Parts[i].Transparency = 0.5
            Parts.CanCollide = false
            delete:Destroy()

              end
            end
        end
    end)
end)

1 answer

✓ Accepted answer

We use a for i,v in pairs

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        Character.Archivable = true        
        while wait(0.1) do
            local clonedCharacter = Character:Clone()
            clonedCharacter.Parent = game.Workspace
            local delete = clonedCharacter:FindFirstChild("HumanoidRootPart")
            local Parts = clonedCharacter:GetChildren()
			for i,v in pairs(Parts) do --Here we use a for loop to get the children of Parts
				if v:IsA("Accessory") then --Then we check if it is an Accessory then we get the Handle
					v.Handle.Transparency = 0.5
					v.Handle.CanCollide = false
				elseif v:IsA("BasePart") then --Here we check if it is a basepart
					v.Transparency = 0.5
					v.CanCollide = false
				end
				delete:Destroy()
			end
        end
    end)
end)

2 comments

0

Works, but im still standing on something, i mean they dont go directly through me, am i missing something?

0

The head and torso do not seem to be able to be CanCollide = false, hence for that you should be using Collision Filtering rather than CanCollide = false.

This discussion is preserved as it was. New answers, comments, and votes are closed.