What solutions have you tried so far?
I tried parenting it, positioning and using :AddAccessory()
Whats the issue?
If I click the button it spawns on the SpawnLocation and does not attach to the player
Code
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AccessoriesFolder = ReplicatedStorage:WaitForChild("Accessories", 1)
local HatFolder = AccessoriesFolder:WaitForChild("Hats")
local DinoFolder = HatFolder:WaitForChild("Dino")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Humanoid = Character:WaitForChild("Humanoid")
local RedDinoHat = DinoFolder.RedDino
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
local CloneHat = RedDinoHat:Clone()
CloneHat.Name = "Hat1"
--CloneHat.Parent = Character
Humanoid:AddAccessory(CloneHat)
end)
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AccessoriesFolder = ReplicatedStorage:WaitForChild("Accessories", 1)
local HatFolder = AccessoriesFolder:WaitForChild("Hats")
local DinoFolder = HatFolder:WaitForChild("Dino")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Humanoid = Character:WaitForChild("Humanoid")
local RedDinoHat = DinoFolder.RedDino
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
local CloneHat = RedDinoHat:Clone()
CloneHat.Name = "Hat1"
--CloneHat.Parent = Character
CloneHat.Handle.Position = LocalPlayer.Character.Head.Position
Humanoid:AddAccessory(CloneHat)
CloneHat.Handle:WaitForChild("AccessoryWeld").Part1 = Character.Head
end)
I tested it in studio and it works! (Make sure you add a weld inside of the handle and make part0 the handle)
If you modify the CFrame for a certain head, what makes me come out with an idea of making a specific table, that stores all the CFrame data for each head, and accessory if needed.