-
What do i want to achieve? I want to make a player wear an accessory by eliminating the ones already worn (on the head)
-
What is the issue? Basically when this local script run, it fires server. The accessory is worn by only one player, but not by everyone
--CLIENT
for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
if v:IsA("Accessory") then
if v.Handle:FindFirstChild("HatAttachment") or v.Handle:FindFirstChild("FaceFrontAttachment") then --FaceFrontAttachment
v:Destroy() --destroy the head accessories
local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
if hum then
game.ReplicatedStorage.addastronauthelmelt:FireServer(game.Players.LocalPlayer)
end
end
end
end
--SERVER
game.ReplicatedStorage.addastronauthelmelt.OnServerEvent:Connect(function(plr)
plr.Character.Humanoid:AddAccessory(game.ReplicatedStorage["Space Hat"]:Clone())
end)