So I made a tool that gives a hat but if I activate the tool it creates the hat but spawns it in the workspace instead of spawning on the player’s head. It doesn’t attach to the player. Here is my script:
local tool = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local torso = Character:WaitForChild("Torso")
local CharMesh = game:GetService("ReplicatedStorage").CharacterMesh
local Humanoid = Character:WaitForChild("Humanoid")
local CatEars = Instance.new("Accessory")
tool.Activated:Connect(function()
Humanoid.WalkSpeed = 0
local Character2 = tool.Parent
wait(1.6)
CatEars.Name = "FluffyEars"
local handle = Instance.new("Part")
handle.Name = "Handle"
handle.Size = Vector3.new(1, 1, 1)
handle.Parent = CatEars
local HatFrontAttachment = Instance.new("Attachment")
HatFrontAttachment.Name = "HatFrontAttachment"
HatFrontAttachment.Position = Vector3.new(0, 0.6, 0)
HatFrontAttachment.Parent = handle
local Earmesh = Instance.new("SpecialMesh")
Earmesh.Name = "EarMesh"
Earmesh.Scale = Vector3.new(1.05, 1.05, 1.05)
Earmesh.MeshId = "rbxassetid://5437810334"
Earmesh.TextureId = "rbxassetid://5457429757"
Earmesh.Parent = handle
Humanoid:AddAccessory(CatEars)
end)