How to change the AccessoryType Value

I have this body armor system that clones the handle of the tool (vest model) into the player. I want to make it an accesory so that it welds naturally to the torso and doesn’t fling to the side when the player aims their gun (the animation forces the head to the side) like it would as a hat. But I get this Unable to assign property AccessoryType. Script write access is restricted error. Help?

Code just in case:

local tool = script.Parent
local handle = tool.Handle

local remotefunction = tool.RemoteFunction
local debris = game:GetService("Debris")

function remotefunction.OnServerInvoke(player,command,value)
	if command == "protect" then
		if value[2] then
			local currentvest = value[1]:FindFirstChild("VestArmour")
			if currentvest then
			local vest ="Accessory")
			vest.AccessoryType = "Waist"
			vest.Name = "VestArmour"
			handle:Clone().Parent = vest
			vest.AttachmentPos =, 1.8, 0.05)
			vest.Parent = value[1]
			local ratio = value[2].Health/value[2].MaxHealth
			value[2].MaxHealth = 100+value[3]
			value[2].Health = (100+value[3])*ratio

Try setting this to


Instead of “Waist”

what’s the enum for? (03 character hahaha)

You use enums when setting specific things like materials, tween directions, styles, etc.

i got this error, idk how to set this bit of code up

Oh, you need to set the AccessoryType like so:

			vest.AccessoryType = Enum.AccessoryType.Waist

i still got the same Unable to assign property AccessoryType. Script write access is restricted error

Ok, create the accessory in the workspace manually, setting the values you’d like, then clone that accessory in the script

1 Like

Another unfortunate case of the documentation not correctly listing a property as unscriptable.

I assume it works when setting manually in the properties window/command bar.