The application of this button would be for hiding other players on your screen in a parkour game. Other players could potentially be playing the same level as you and therefore be in your screen view. You should be able to toggle whether other players are visible on your screen or not.
I have a screen GUI with a frame inside and a textButton inside the frame. The local script is located inside of the textButton.
local hideButton = script.Parent.Parent.HidePlayers
local Players = game:GetService("Players")
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local chr = plr.Character
local hum = chr:WaitForChild("Humanoid")
function hideOrShowOthers()
if hideButton.Text == "Hide Players" then
hideButton.Text = "Show Players"
for i, v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("Humanoid") then
if plr.Name ~= v.Name then
v.Humanoid.LocalTransparencyModifier = 1
else
v.Humanoid.LocalTransparencyModifier = 0
end
end
end
end
if hideButton.Text == "Show Players" then
hideButton.Text = "Hide Players"
for i, v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("Humanoid") then
if plr.Name ~= v.Name then
v.Humanoid.LocalTransparencyModifier = 0
else
v.Humanoid.LocalTransparencyModifier = 0
end
end
end
end
end
hideButton.MouseButton1Click:Connect(hideOrShowOthers)
My biggest issue so far is understanding what to loop through and how to loop through all the currently connected players and get their humanoids, so that I can use LocalTransparencyModifier to change their transparency. If my Idea is wrong, I would appreciate corrections on why I wouldn't be able to do so.
Also, if my code is not good enough to understand the concept, I would appreciate hints on how I could go about completing it. I am not looking for someone to do all the work for me but instead would like to use this question as a way to help me learn how my concept is wrong and how I can improve on the concept I have given in order to eventually complete it.
So, how I would be able to manipulate the transparency of every player connected to the game on a button click, so that they are invisible to you and only you until you click the button again? Keep in mind that your player must always be visible and the character visibility changes should only happen on your own screen so that other players can use the button for the same purpose (of making other players not visible on your screen).
I am quite new to Roblox Studio, so I would appreciate any explanations about why my thought process might be wrong and how to improve my problem-solving skills in Roblox.

10 comments
also there might be hats with parts in them, so do the same thing just create another lop that checks inside accessories inside each charactor, and then make the handle of the accessory transparent too :)
also if you dont want your character to be invisible, just check for the name of each player, if its the name of your character, then make it not loop through it.
also, player collision is already turned off in my game
BRUH, JUST PUT THIS IN A LOCAL SCRIPT, USE REMOTE EVENT TO ACTIVATE LOCALSCRIPT FROM THR SERVER SIDE BUTTON. and also i commented how to not make yourself invisible, just check if the player being tested is game.PLayers.LocalPlayer since its localscript, if it ism then dont run it, then it wil continue to all other players
one question why would i be using transparency and not local transparency modifier
ok then just use local transpareny modifier, i script using old methods but you dont have to. I see no extra work in adding one remove event and then calling it and receiving it and then just using transparency. They both work. Also, dont use many loops like i said its actually more efficient to just use GetDescendants() of the character that way it will get every part no matter where it is in th
Ill try that out using your old method and test it. Thanks!
I've got it to work but the players face is still visible. what can i do to make sure the face is invisible as well?
also, when i press the button to show the players again, i see a gray torso inside of my torso. how would i fix that?
ok so the grey thing, as you may know, is the humanoid root part, just put in a line of code to always ignore it, and for the face, put in an extra line to also always change its transparency. Give me a minute ill change the code to do that. Also, we could use pcall here to make everything transparent that can be, but its not worth it, just add two extra lines and it will do. by the way it looks l