How do you make all players hats disappear

how do you make a GUI button that makes all players hats without the players Noticing is there a way to do it?

2 Likes

TextButton and Transparency. Not sure what you meant by “makes all players hats without the players noticing” though, that part’s unclear. Are you trying to hide a hat for a player while others can still be able to see it? LocalTransparencyModifier might help.

2 Likes

yes i was trying to say that sorry for my bad english

So? BasePart | Roblox Creator Documentation

I think I understand what you mean, correct me if I am wrong, but this article should help you.

1 Like

I’m not trying to make all the objects transparent i wanted the other players hats transparent

I am guessing you want to make all hats on other players invisible on a client?
Loop through a table of players and set the transparency to 1. This needs to happen in a local script ofc

local Players = game:GetService("Players")
local Button = script.Parent.ScreenGui.TextButton--adjust to your button

Button.MouseButton1Up:Connect(function()
	for i,player in ipairs(Players:GetPlayers())do
		local char = player:FindFirstChild("Character")
		if char then
			local Hat = char:FindFirstChild("Hat")--put the name of the hat here
			if Hat then
				Hat.Transparency = 1
			end 
		end
	end
end)

If you want hats to be transparent on the client side for just the person who clicks the button, then you need to -

  1. Create a TextButton, connect the MouseButton1Down event to a function
  2. In this function, have a for loop run through every single player using :GetChildren(), include another for loop inside this that runs through every child instance of the players character, checks if it is a accessory using :IsA()
  3. If it is a accessory, then change it’s Transparency to 1

If you want to change every players hat to be transparent, for everyone to see when someone clicks a gui button, you need to -

  1. Do step 1 above
  2. In this function, fire an event to the server using :FireServer()
  3. In a server side script, recieve this event and follow steps 2 and 3 above
2 Likes