I have asked on the discord and gotten some help with code snippets but I have not been successful so far.
game.Players.PlayerAdded:Connect(function(character) local function set_transparency(instance, transparency) for _, v in pairs(instance:GetDescendants()) do if v:IsA("BasePart") or v:IsA("Decal") or v:IsA("GuiBase3d") then v.Transparency = transparency end end end set_transparency(character, 1) end)
Your function works, you just need to input the character (not the player). This has a super simple fix:
local function set_transparency(model, transparency) for _, v in pairs(model:GetDescendants()) do if v:IsA("BasePart") or v:IsA("Decal") or v:IsA("GuiBase3d") then v.Transparency = transparency end end end game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) set_transparency(character, 1) end) end)
You would just connect to the CharacterAdded event and run each character through your function. As another thing, you don't need to redefine your function for each player! It's better to put the function outside as you can still use it for each player.
local selectedTransparency game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(chr) delay(.5, function() --// Function delay to make sure the character has been added. if chr then for _,parts in pairs(chr:GetChildren()) do wait() if parts:IsA("BasePart") or parts:IsA("Part") or parts:IsA("MeshPart") or parts:IsA("GuiBase3d") or parts:IsA("Decal") then selectedTransparency = 1 parts.Transparency = selectedTransparency wait() else if parts:IsA("Accessory") then --// Ghost Mode parts:Remove() --// Don't have to add this. end end for _,parts_2 in pairs(parts:GetChildren()) do if parts_2:IsA("Decal") then parts_2.Transparency = 1 --// Will remove the face end end end end end) end) end)