I was told I needed to weld the hat into the players head, although with that I have no actual idea how to weld things (I script GUIs and stuff but not items) How would I do this?
This is my script
local Player = game.Players.LocalPlayer
local HatsAvailable = {}
local Count = 0
local LeftButton = script.Parent.LeftHat
local RightButton = script.Parent.RightHat
for i,v in pairs(game.ReplicatedStorage.ClothingLow.HatsLow:GetChildren()) do
table.insert(HatsAvailable,v)
end
function RemoveCurrentHats()
for i,v in pairs(Player.Character:GetChildren()) do
if v.ClassName == "Accessory" then
v:Destroy()
print("RIP HAT")
end
end
end
function Update()
script.Parent.Buying.Value = true
RemoveCurrentHats()
script.Parent.ItemName.Text = HatsAvailable[Count].Name
script.Parent.Price.Text = "$"..HatsAvailable[Count].Price.Value
local HatTheyBoughtClone = HatsAvailable[Count]:Clone()
HatTheyBoughtClone.Handle.HatAttachment.Position = Player.Character.Head.Position
HatTheyBoughtClone.AttachmentPos = Player.Character.Head.Position
HatTheyBoughtClone.AttachmentPoint = Player.Character.Head.CFrame
Player.Character.Humanoid:AddAccessory(HatTheyBoughtClone)
end
script.Parent.LeftHat.MouseButton1Click:Connect(function()
if Count >1 then
Count = Count - 1
Update()
end
end)
script.Parent.RightHat.MouseButton1Click:Connect(function()
if Count >= #HatsAvailable then
else
Count = Count + 1
Update()
end
end)
script.Parent.Parent.Decline.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent:Destroy()
end)
Like I said no actual idea how to weld anything

1 comment
Thanks I can figure out how to reposition it