I have no idea what this is called because I am not a scripter…
I’m trying to make everyone that spawns into the game have a certain accessory on, in my case it is a back item (that is UGC). I’ve tried YT tutorials but they don’t work How can I do this?
local accessoryId = 5621576440 -- Replace this id with the one you want to use
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
local Hat = game:GetService("InsertService"):LoadAsset(accessoryId)
local accessory = Hat
for i,v in pairs(accessory:GetChildren()) do
if(v.ClassName == "Accessory")then
Char.Humanoid:AddAccessory(v)
break
end
wait()
end
end)
end)
-- A "Script" in Workspace, or ServerScriptService
local serverStorage = game:GetService("ServerStorage")
local players = game:GetService("Players")
local accessory = serverStorage.Accessory
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hat = accessory:Clone()
hat.Parent = character
hat.Position = CFrame.new(x, y, z)
end)
end)