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
 

Re: How to attach a part/multiple parts to the head?

Previous Thread :: Next Thread 
crystal12752 is not online. crystal12752
Joined: 06 May 2011
Total Posts: 407
10 Apr 2015 10:40 PM
I have a script that just won't work.
It's a script that I'm starting off with in my adventure to learning how to LUA (something like that). It's supposed to attach a hat onto a player upon joining.
At first the script worked, but then I wanted it to be so that it'd be a part attached to the player so that once they press, "=", they can take off other hats, just not that one (since it would be a part :D)

It's an anonymous function, and whenever I try to use something such as "if...." or "for i, v in ipairs(____) do" and whatever, it doesn't work and tells me that I should take the parentheses off the two ends at the end of the script.
This seems strange to me, as I'm not that familiar with Anonymous Functions yet.


here's the script that worked:

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local h = Instance.new("Hat")
local p = Instance.new("Part")
local m = Instance.new("SpecialMesh")
h.Name = "Goggles"
h.Parent = character
h.AttachmentPos = Vector3.new(0, 0.1, 0)
h.AttachmentForward = Vector3.new(-0.773, -0.404, -0.489)
h.AttachmentRight = Vector3.new(0.533, 0.002, -0.846)
h.AttachmentUp = Vector3.new(-0.343, 0.915, -0.214)
print("It's working!")
p.Parent = h
p.Position = character:findFirstChild("Head").Position
p.Name = "Handle"
p.FormFactor = "Custom"
p.Size = Vector3.new(1.07, 0.46, 1.06)
p.Locked = true
p.CanCollide = false
print("WORKING!")
p.BottomSurface = "Smooth"
p.TopSurface = "Smooth"
print ("YES! WORKING!!! YES!!!")
m.Parent = p
m.MeshId = "http://www.roblox.com/asset/?id=201181221 "
m.MeshType = "FileMesh"
m.Scale = Vector3.new(0.9, 0.9, 0.9)
m.TextureId = "http://www.roblox.com/asset/?id=201181255 "
m.VertexColor = Vector3.new(1, 1, 1)
print ("IT WORKED! YES. NOW JUMP FOR JOY AND POTATO.")

end)
end)


(Don't ask why I made the bottom and top surfaces smooth, lol. I just felt like it.)

And then I wanted to make it so that it would be a part that would be attached to the person's head.

Does anyone know how to make such a function that would do this? :o
I tried doing it, but it turned into an ugly script that you would probably laugh at. Lol.
It's sorta like having a script that makes your head's transparency 0 when it already is. D:

I need help. Soon? :o





I am an owl.
Report Abuse
crystal12752 is not online. crystal12752
Joined: 06 May 2011
Total Posts: 407
11 Apr 2015 08:58 AM
Help?
Bump.
Report Abuse
crystal12752 is not online. crystal12752
Joined: 06 May 2011
Total Posts: 407
11 Apr 2015 10:29 AM
Hello? I need help, anyone?


I am an owl.
Report Abuse
crystal12752 is not online. crystal12752
Joined: 06 May 2011
Total Posts: 407
11 Apr 2015 05:02 PM
No one?
Okay then...



I am an owl.
Report Abuse
SimonroeOfficial is not online. SimonroeOfficial
Joined: 24 Dec 2015
Total Posts: 1
26 Aug 2016 10:55 PM
sary man can't help.
Report Abuse
skydude221 is not online. skydude221
Joined: 15 May 2013
Total Posts: 5014
26 Aug 2016 11:02 PM
attach multiple parts to the head


-skydude221, cringiest posts out there
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