const MAX_AVATAR_EXTENTS_SIZE = Vector3.new(25, 25, 25)
--// Roblox Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--// Module Imports
local safePlayerAdded = require(ReplicatedStorage.Modules.Shared.safePlayerAdded)
--// Functions
local function onCharacterAppearanceLoaded(player: Player, character: Model)
local extentsSize = character:GetExtentsSize()
if extentsSize.X <= MAX_AVATAR_EXTENTS_SIZE.X
and extentsSize.Y <= MAX_AVATAR_EXTENTS_SIZE.Y
and extentsSize.Z <= MAX_AVATAR_EXTENTS_SIZE.Z
then
return
end
for _, child: Instance in character:GetChildren() do
if child:IsA("Accessory") then
child:Destroy()
end
end
end
local function onPlayerAdded(player: Player)
player.CharacterAppearanceLoaded:Connect(function(character: Model)
onCharacterAppearanceLoaded(player, character)
end)
if player.Character and player:HasAppearanceLoaded() then
onCharacterAppearanceLoaded(player, player.Character)
end
end
local function initialize()
safePlayerAdded(onPlayerAdded)
end
initialize()```
1 Like