button.MouseButton1Click:Connect(function()
Character.Humanoid:AddAccessory(HairClone) -- Adding the accessory
HairClone.Handle:WaitForChild("AccessoryWeld").Part1 = Character.Head -- Setting a weld's Part1 to the characters head.
end)
Also, you have a MouseButton1Click, which is used for UI. You are only running this code on the client. Use a Remote Event to fire the server and place it properly. Else, the hat will only appear for the player.
u need an EVENT in Replicated Storage
change de event name in the script, bc i called it “Equip”
and the hat is in the Replicated storage
NOTE: to the script works, The button NAME have to be the same of your HAT NAME
script in SSS
local replicatedStorage = game:GetService("ReplicatedStorage")
local equip = replicatedStorage:WaitForChild("Equip")
local hat = replicatedStorage.Halo1
equip.OnServerEvent:Connect(function(player, item)
local character = player.Character
local humanoid = character.Humanoid
local clone = hat:Clone()
humanoid:AddAccessory(clone)
end)
–script inside the button (localScript)
local replicatedStorage = game:GetService("ReplicatedStorage")
local gearEvent = replicatedStorage:WaitForChild("Equip")
local buy = script.Parent
buy.MouseButton1Click:Connect(function()
local item = buy.Name
gearEvent:FireServer(item)
end)