#I have a problem with my hat giver

1 messages · Page 1 of 1 (latest)

wooden osprey
#

why not use accessory's ?

#

that will weld it for you

molten wave
#

Im using this script because of ClickD and becase i can take it off any time

wooden osprey
#

ill make you a small demo with Accessories

molten wave
#

Alright tysm

abstract dust
#

You don't have primary part cframe set

wooden osprey
#

this is how you give a accessory as shown in the demo above

-- get the players humanoid
local humanoid = player.Character.Humanoid

-- get all the accessories they currently have equipped
local accessories = humanoid:GetAccessories()

-- loop all the accessories and if they already have a hat exit and do nothing
for i, accessory in accessories do
  if accessory.AccessoryType == Enum.AccessoryType.Hat then
    print(player.Name, "already has a hat")
    return
  end
end

-- if they dont have a hat lets clone the hat from ServerStorage
local hat = game.ServerStorage.MyCoolHat:Clone()

-- lets now attach the hat to there head
humanoid:AddAccessory(hat)
molten wave
#

Oh i seee

wooden osprey
#

and this is how we remove a accessory

-- get the players humanoid
local humanoid = player.Character.Humanoid

-- get all the accessories they currently have equipped
local accessories = humanoid:GetAccessories()

-- loop all the accessories and if we find a hat destroy it
for i, accessory in accessories do
  if accessory.AccessoryType == Enum.AccessoryType.Hat then
    accessory:Destroy()
  end
end
molten wave
#

Tysm

molten wave
wooden osprey
#

yes close post if your finished