|
| 16 Aug 2016 12:06 PM |
This function when given the right information needed to run will run correctly and place the hat itself within the player and in studio it looks fine, but within a Roblox server it places the hats on the players neck, does anybody know how to fix this This must universally work with all hats that are attached to the head so wings/swords are not included.
function purchaseHat(itemId) hatModel = game:GetService("InsertService"):LoadAsset(itemId) hatTable = hatModel:GetChildren() print(hatTable[1].Name) hat = hatModel:FindFirstChild(hatTable[1].Name) --print(hatModel.Name) --print(hat.Name) hatModel.Parent = player.Character hat.Parent = player.Character hatModel:Destroy() --hat.Handle.Position = player.Character:FindFirstChild("Head").Position hat.Handle.Locked = true --[[ hat.AttachmentForward = Vector3.new (-0, -0, -1) hat.AttachmentPos = Vector3.new(0, 0.4, 0) hat.AttachmentRight = Vector3.new (1, 0, 0) hat.AttachmentUp = Vector3.new (0, 1, 0) --]] weld = Instance.new("ManualWeld") weld.Parent = hat.Handle weld.Part0 = hat.Handle weld.Part1 = player.Character:FindFirstChild("Head") end
~It's always better in the night |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 16 Aug 2016 12:20 PM |
I've seen this before, what you can do to avoid it is anchor the hat and the player's head while you apply the welds, then wait() and then unanchor.
However, since it's truly a hat object, you shouldn't have to apply welds at all, just parenting the hat to the character should be enough.
|
|
|
| Report Abuse |
|
|
|
| 16 Aug 2016 12:23 PM |
I actually just solved it by deprecated the weld, once the hat is within the player it automatically attaches to their head correctly and the weld would weld it dead center on the head.
~It's always better in the night |
|
|
| Report Abuse |
|
|