|
| 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 |
|
| |
|
| 11 Apr 2015 10:29 AM |
Hello? I need help, anyone?
I am an owl. |
|
|
| Report Abuse |
|
|
| 11 Apr 2015 05:02 PM |
No one? Okay then...
I am an owl. |
|
|
| Report Abuse |
|
| |
|
| 26 Aug 2016 11:02 PM |
attach multiple parts to the head
-skydude221, cringiest posts out there |
|
|
| Report Abuse |
|