generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Hat Positioning?

Previous Thread :: Next Thread 
MethChef is not online. 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 is not online. MethChef
Joined: 22 Jan 2014
Total Posts: 43
12 Apr 2015 06:42 PM
bump
Report Abuse
MethChef is not online. MethChef
Joined: 22 Jan 2014
Total Posts: 43
12 Apr 2015 06:57 PM
bump again
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
12 Apr 2015 06:57 PM
Whats not working?
Report Abuse
MethChef is not online. 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
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
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 is not online. 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
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
12 Apr 2015 07:23 PM
Is it just not getting set? Or is it not setting correctly.
Report Abuse
MethChef is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image