Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
0
Answered by
Codebot 85
8 years ago

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.

0
I had a figure you would need to clone but I used "hat" and that didn't work thanks for the help Clakker200 5 — 8y
0
1st line what do I put there though? Clakker200 5 — 8y
0
The player. So like...button.Parent.Parent.Parent (Idk how many parents, once again your display) until it reaches Player1 Codebot 85 — 8y
0
thank you Clakker200 5 — 8y
Ad

Answer this question