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

How do I remove hats on a button then get them back ?

Im trying to make a gui that welds a hat to your head and also remove your current hat then if you press it again it comes back and removes weld any ideas?

1 answer

✓ Accepted answer

First off, you'll need to make a clone of the user's hats with :Clone()

Put it in a folder or a model for storage.

You can go on the roblox wiki for the welding. http://wiki.roblox.com/index.php?title=Weld

now if they click again the button that removes all the new hats it would be something like

hats = --Character, idk your display
for i = 1,#hats do
if hats[i]:IsA("Hat") or hats[i]:IsA("Model") then -- I added model because its probably going to be a free model? or just a model the the hat itself :P
hats[i]:remove()
end 

now you just need to weld the hats back from the storage.

4 comments

0

I had a figure you would need to clone but I used "hat" and that didn't work thanks for the help

0

1st line what do I put there though?

0

The player. So like...button.Parent.Parent.Parent (Idk how many parents, once again your display) until it reaches Player1

0

thank you

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