welding error bad cast?
I was trying to weld this hat on top of my character's head and i got bad cast i never encountered this error before so some help would be great!
player=script.Parent.Parent
repeat wait() until player
c=player.Character
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat"
p.Parent = h
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
weld=Instance.new("Weld",h)
weld.Part0=h
weld.Part1=c["Head"]
h.Parent=c
weld.C1=CFrame.new(0,2,0)