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

Remove Players hats?

I tried using this script to remove a players hat but its kinda broken. Please help

PhantomHead = Phantom.Character.Head
PhantomHats = PhantomHead.GetInstance("Hat")
PhantomHats:Remove()

1 answer

You could remove all player hats by iterating over a table of all of the character's children. It seems as if you didn't define what Phantom is and I would also suggest using Destroy(). This script goes through all of the children, checks whether or not it is a hat object and destroys it if it is but leaves it alone if it is not. Please remember to define what phantom is.

--phantom = -- define who phantom is--

for i, v in pairs(phantom.Character:GetChildren()) do
	if v:IsA("Hat") then
		v:Destroy()
	end
	wait()
end

1 comment

1

You do not need the wait, it won't lag the game.

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