Anti Brick/Hat Spawn Exploit Script

This is a script I created with assistance from TheFurryFish to block the brick/hat spawn exploit shown here: https://youtu.be/QpFw7xv-Dm0?t=149

--Anti Brick/Hat Spawn exploit by Christbru01 and TheFurryFish
function Scan_Item_For_Accoutrement(Plr,Item)
	if Item:IsA("Accoutrement") then
		local connect = Item.AncestryChanged:connect(function(obj,newloc)
			if newloc and not game.Players:GetPlayerFromCharacter(newloc) and not game.Players:GetPlayerFromCharacter(obj) then
				Plr:Kick("Brick spawn exploit detected")
				repeat wait() until obj.Parent == newloc --This prevents "Trying to set parent while setting parent" warnings from being spammed in the server logs
				repeat Item:Destroy() wait() until not Item.Parent
				repeat obj:Destroy() wait() until not obj.Parent
			end
		end)
	end
end

function Search_Item_For_Accoutrement(Plr,Item) --Don't want to make it too easy and let them simply hide/bury the accoutrement to avoid the scanner
	if Item:IsA("Accoutrement") then
		Scan_Item_For_Accoutrement(Plr,Item)
	else
		for _,NewItem in pairs(Item:GetChildren()) do
			Search_Item_For_Accoutrement(Plr,NewItem)
		end
	end
end

function New_Character(Plr,Char)
	Char.DescendantAdded:connect(function(Item)
		Scan_Item_For_Accoutrement(Plr,Item)
	end)
	Search_Item_For_Accoutrement(Plr,Char)
end

game.Players.PlayerAdded:connect(function(Plr)
	Plr.CharacterAdded:connect(function(Char) New_Character(Plr,Char) end)
	if Plr.Character then New_Character(Plr,Plr.Character) end
end)
6 Likes

You should also be able to listen for changes to StarterGear. This exploit works because StarterGear’s contents get cloned.

4 Likes

Wouldn’t that require it being placed in a localscript which may or may not be disabled by the exploiter’s exploit? The solution I posted is completely server-side and provides both exploit prevention and player detection. I’m just curious as I didn’t think the StarterGear changes replicate to the server from the client. o.o

script.Parent=nil or call Destroy on the script on the client.

Some exploits are capable of still disabling any localscript regardless whether it is nil-parented or not.

Destroy the StarterGear!

1 Like

Should also check StarterCharacterScripts. That was an old one that worked the same as this and I am unsure if it was fixed. @ConvexHero can confirm?

Instances under StarterPlayer should now be filtered in FE places. In a strange twist, they actually were filtered in experimental mode places in the past.

Destroying StarterGear is not entirely effective. For legacy reasons, StarterGear is created on the client. The server will accept exactly one StarterGear parented to the Player object.

1 Like

Awesome, another exploit patched. Thanks for acting on this exploit/glitch quickly. :slight_smile: