Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make accesories transparent?

Asked by 6 years ago

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

Log in to vote
0
Answered by
RoyMer 301 Moderation Voter
6 years ago

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)

0
Works, but im still standing on something, i mean they dont go directly through me, am i missing something? SuperBeeperman 30 — 6y
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. RoyMer 301 — 6y
Ad

Answer this question