Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make every player in my game wear an accesory?

I don't know what else to say except read the title.

2 answers

✓ Accepted answer
local accessory = path.to.accessory -- change path.to.accessory to your accessory, please make the instance be a Accessory!
for _, p in next, game:GetService("Players"):GetPlayers do -- loop through all the players
if p.Character then -- if player has character
accessory:Clone().Parent = p.Character -- clone and parent to character
end
end

If this helps, please mark as a solution, Metatable out!

EDIT: radiant_light's script would work better if you were wanting it to be permanent.

1 comment

0

This will only work once, and that is when it is run. It's better to connect it to the CharacterAdded event so that everyone who joins will get the hat which is what the poster might have intended.

Metatable's script is good, it'll work but it won't work on players that join after the script is run. This script is pretty simple, it connects a function to whenever a player joins and adds an accessory when he spawns.

local accessory = nil -- replace nil with the place your accessory is

game:GetService("Players").PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		accessory:Clone().Parent = Character
	end)
end)

Read more about custom accessories:

https://developer.roblox.com/en-us/api-reference/class/Accessory

EDIT: Metatable's comment will give you an idea on how to insert assets from the catalog.

1 comment

1

InsertService:LoadAsset

This discussion is preserved as it was. New answers, comments, and votes are closed.