RemoveHats Command

I Made a headless, command, but now I want a RemoveHats Command.


local Command = "/headless" or "/headless "
local LeaveCommand = "/unheadless" or "/unheadless "

--[ FUNCTIONS ]--

game.Players.PlayerAdded:Connect(function(player) -- When Player Join
	player.CharacterAdded:Connect(function(chr) -- Grabs Player Character
		player.Chatted:Connect(function(msg) -- When Player Chats
			
			-- IF start --
			
			if msg:sub(1, Command:len()):lower() == Command:lower() then -- if msg is /e headless then
				player.Character.Head.Transparency = 1 -- makes head transparent
				player.Character.Head.face.Transparency = 1 -- makes face transparent
			else
				if player.Character.Head.Transparency == 1 then -- if head is transparent
					if msg:sub(1, LeaveCommand:len()):lower() == LeaveCommand:lower() then -- and if msg is /e unheadless then
						player.Character.Head.Transparency = 0 -- makes head untransparent
						player.Character.Head.face.Transparency = 0 -- makes face untransparent
					end
				end
			end
			
			-- IF end --
			
		end)
	end)
end)```

https://developer.roblox.com/en-us/api-reference/function/Humanoid/RemoveAccessories

1 Like