Adding an accessory on playeradded

Is there a way that I could add an accessory to the player’s character on playeradded in a server script?

Something along these lines:

game.Players.PlayerAdded:Connect(function(plr)
--add accessory to the player
end)

In the future I plan to use this for special game perks, so only certain players will get certain items, hence the playeradded script.

If anyone could help that would be great! :slightly_smiling_face:

Thanks!

You could just put the accessory in StarterPlayer > StarterCharacterScripts

1 Like

That would apply to every character though… wouldn’t it?
If possible I was thinking of doing this per each player so i can add the accessory only to certain players.
Is there a way to do that from startercharacter script?

Well, you could insert a script and put something inside like this:

local name = "WindingTheRopes"

if script.Parent.Parent.Name == name then
    -- put code here if you want
else
    script.Parent:Destroy()
end

Just change the name

1 Like

so that would be in starter character scripts or server

It would go directly inside the accessory

1 Like

You could simply add a server script in StarterCharacterScripts…

local accessory = script.Accesory -- insert an accessory in the script
accessory.Parent = script.Parent

This will add the accessory to the character when the character has loaded.
If you want a level of security, add the line to the top of the script:
if script.Parent.Name ~= "WindingTheRopes" then return end

1 Like