Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How in the world do I make a script that hides hats?

So, my main issue is that I have no freaking clue on how to make a script where a GUI pops up on your screen.

You click the GUI, and it equips your helmet but hides your hair. No clue how to do that in the slightest. Which is why I'm here, please respond, and have a nice day.

3 comments

0

Check the wiki articles about text/image buttons and accesories. You will also need to use remote events, so maybe give the article covering that topic a look aswell.

0

You can set the MeshId of the Mesh ID to nothing to "remove" the hat when the button is clicked.

0

Or just remove the hat using :Destroy() or :Remove()

2 answers

If you want to hide the hats, you'll want to set the transparency of their handles to 1. Otherwise, you can call destroy on them. It's quite easy. On the server, you'll run a loop that deletes any accessory on the character, something like this:

for _, v in pairs(character:GetChildren()) do
	if v:IsA('Accessory') then
		v:Destroy() -- or v.Handle.Transparency = 1
	end
end

Now for the button clicking. You may want to read up on remote events for this one. Assuming you know how to listen to button clicks, just call FireServer on the remote and handle it by removing the accessories from the player that clicked the button.

some things to read:

https://developer.roblox.com/en-us/api-reference/class/RemoteEvent https://developer.roblox.com/en-us/api-reference/class/GuiButton

This discussion is preserved as it was. New answers, comments, and votes are closed.