How to add an accessory using AddAccessory() code

so i want use AddAccessory code this is the script:

local Backpack = game.ServerStorage.r6
local ProximityPrompt = script.Parent
local Player = game.Players
local Humanoid = Player:WaitForChild("Humanoid")

ProximityPrompt.Triggered:Connect(function()
	Humanoid:AddAccessory(Backpack)
end)

image
so this is the accessory
i want player to use it using ProximityPrompt

sorry i’m is beginner scripter :sweat_smile:

1 Like

You can do something like this:

local Backpack = game.ServerStorage.r6
local ProximityPrompt = script.Parent

ProximityPrompt.Triggered:Connect(function(player) -- player who triggered it
	local clone = Backpack:Clone() -- clone it for multiple uses
local Humanoid = player.Character:WaitForChild("Humanoid") -- humanoid is in the player's character
Humanoid:AddAccessory(clone) -- finally add the accessory we cloned to the player's humanoid
end) 

image

it’s work thank you

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.