The script and accessory below do not show on the player when I try add them via AddAccesory what am i doing wrong, nothing comes up in the output and the accessory is parented to the player.
thank you all
game:GetService("Players").PlayerAdded:Connect(function(plr)
plr.CharacterAppearanceLoaded:Connect(function(char)
if plr.UserId == 2908325943 or plr.Name == 'hellothere3681' or plr.Name == 'Ryujii' or plr.Name == 'Itsuk1264' then
local clo = game:GetService("ReplicatedStorage").Y6HN8L1DX:Clone()
clo.Parent = workspace
char.Humanoid:AddAccessory(clo)
end
end)
end)
This is most likely because of the formatting of your if statement. I’d recommend looping through a table with all the user IDs in it to see if the player’s user id is in that table. If so, add the accessory.
Like so:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AccessoryUsers = { -- This is the table that will be looped through
2908325943, -- Itsuk1264's UserId (A.K.A Ryujii)
2214693596 -- hellothere3681's UserId
}
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local Humanoid = char:WaitForChild("Humanoid")
for i,userId in pairs(AccessoryUsers) do -- We loop through the table here
if plr.UserId == userId then -- If the player's UserId is equal to one of the numerical values in the table, then the tool will be cloned.
local clo = ReplicatedStorage.Y6HN8L1DX:Clone()
clo.Parent = workspace
char.Humanoid:AddAccessory(clo)
end
end
end)
end)
Here’s a good article on future-proofing your code, and I highly recommend you check this out for more elaboration on formatting your code.