MethChef
|
  |
| Joined: 22 Jan 2014 |
| Total Posts: 43 |
|
|
| 12 Apr 2015 06:16 PM |
I'm trying to make a hat giver, but when I try and change the Attachment properties of the hat, it doesn't work. What am I doing wrong? Everything else in the script works fine.
function Hair(playerWhoClicked) local plr = playerWhoClicked local Character = plr.Character if plr ~= nil then -- "player" does not exist. local d = Character:GetChildren() for i=1, #d do if (d[i].className == "Hat") then d[i]:remove() local debounce = true
if (Character:findFirstChild("Humanoid") ~= nil and debounce == true) then debounce = false local forward = Vector3.new(0,0,1) local pos = Vector3.new(0,0.25,-0.4) local right = Vector3.new(1,0,0) local up = Vector3.new(0,1,0) local h = Instance.new ("Hat", Character) local p = Instance.new ("Part", Character) local hweld = Instance.new ("Weld", Character) h.Name = "UnkleHair" p.Parent = h p.Name = "Handle" h.AttachmentForward = forward h.AttachmentPos = pos h.AttachmentRight = right h.AttachmentUp = up hweld.Parent = p hweld.Part0 = p hweld.Part1 = Character.Head hweld.C1 = CFrame.new(h.AttachmentPos) local m = Instance.new ("SpecialMesh") m.Parent = p m.MeshId = "http://www.roblox.com/asset/?id=1136139" m.TextureId = "http://www.roblox.com/asset/?id=173781040" p.Anchored = false m.Scale = Vector3.new(2.14, 2.2, 2.2) debounce = true end end end end end
script.Parent.ClickDetector.MouseClick:connect(Hair)
|
|
|
| Report Abuse |
|
|
MethChef
|
  |
| Joined: 22 Jan 2014 |
| Total Posts: 43 |
|
| |
|
MethChef
|
  |
| Joined: 22 Jan 2014 |
| Total Posts: 43 |
|
| |
|
| |
|
MethChef
|
  |
| Joined: 22 Jan 2014 |
| Total Posts: 43 |
|
|
| 12 Apr 2015 07:04 PM |
| in the script, everything works fine except the part where i change the attachment properties of the hat. in the script i tried making the attachmentforward 0,0,1 but it doesn't work. |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 07:10 PM |
If I were you, I'd maybe precreate the hat object and store it in the script, then clone it and place the new part inside of it.
|
|
|
| Report Abuse |
|
|
MethChef
|
  |
| Joined: 22 Jan 2014 |
| Total Posts: 43 |
|
|
| 12 Apr 2015 07:22 PM |
but why doesnt this work?
local forward = Vector3.new(0,0,1) local pos = Vector3.new(0,0.25,-0.4) local right = Vector3.new(1,0,0) local up = Vector3.new(0,1,0)
h.AttachmentForward = forward h.AttachmentPos = pos h.AttachmentRight = right h.AttachmentUp = up |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 07:23 PM |
Is it just not getting set? Or is it not setting correctly.
|
|
|
| Report Abuse |
|
|
MethChef
|
  |
| Joined: 22 Jan 2014 |
| Total Posts: 43 |
|
|
| 12 Apr 2015 07:28 PM |
| it doesnt get set to the ones in the script |
|
|
| Report Abuse |
|
|