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

How to make all parts and hats in a player transparent without writing a long line ?

Trying to write a script that make the player transparent but it's just too long

1 comment

0

You could try using for i,v in pairs (game.Players.LocalPlayer.Character) do then use IsA

2 answers

✓ Accepted answer

Paste the following script;-

for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
if v.IsA("Accessory") then
wait()
v:FindFirstChild("Handle").Transparency = 1
end
end

--now for parts

for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
if v.IsA("Part") then
wait()
v.Transparency = 1
end
end

LocalScript inside of StarterCharacterScripts.

local player = game.Players.LocalPlayer
local character = player.Character

local function ghost(part)
	if part:IsA("BasePart") then 
		part.Transparency = 1;
	end
end

-- Invokes AFTER the for loop when something is added to character.
character.DescendantAdded:connect(function(part)
	ghost(part)
end)

-- Takes everything that is currently loaded in character and calls ghost
for i,v in pairs(character:GetChildren()) do 
	ghost(v)
end

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