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
currentvest:Destroy()
end
local vest = Instance.new("Accessory")
vest.AccessoryType = "Waist"
vest.Name = "VestArmour"
handle:Clone().Parent = vest
script.Parent.Handle.EquipFlakVest:Play()
vest.AttachmentPos = Vector3.new(0, 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
wait(1)
script.Parent.Handle:Destroy()
wait(0.05)
tool:Destroy()
end
end
end