I am wondering how to make all characters in a roblox game turn invisible (via script)? If you can tell me the code that would be great. :) (I am a new developer which is why I don't know this code.)
You could easily loop through all the characters.
Example of i, v pairs: (looping through all players)
local Players = game.Players.GetPlayers() for i, v in pairs(Players) do -- looping all players print(v.Name) -- all players names end
Making all players invisible:
local Players = game.Players.GetPlayers() -- all players for i, v in pairs(Players.Character) do -- looping all characters v.Transparency = 1 -- makes them invisible end
More information: https://www.lua.org/pil/7.3.html
This is fairly simple with the pairs loop.
for _, k in pairs(game.Players:GetPlayers()) do for _, v in pairs(k.Character:GetChildren()) do if v:IsA("Part") or v:IsA("BasePart") then --Making sure it has the transparency property to avoid errors v.Transparency = 1 end end k.Character.Head.Face.Transparency = 1 --Invisible face end