Don't Show Other Players UI

I need help showing a UI that when you press a button it shows no other players except for yourself. I have to UI and button made but do not know what I should script.

Access the UI by using script.Parent until you get the UI, assuming you are using a LocalScript inside of a TextButton or ImageButton.

Technically this can be done through a local script, I am not sure if this is correct so ye .


local button;
local Players = game:GetService("Players")
button.Activated:Connect(function()
for _, player in pairs(Players:GetPlayers()) do
	local character = player.Character:Wait()
if player ~= Players.localplayer then
character.Parent = game.ReplicatedStorage
end
end
end)

Since its a local script this will all be done through client, it would not effect other players.

Just use a localscript within your GUI to handle it. Local scripts are individual to the client therefore changes made on them are local and only visible to the client of that script.