Morvek
|
  |
| Joined: 19 Jul 2011 |
| Total Posts: 264 |
|
|
| 12 Feb 2012 10:35 AM |
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) GroupID = 386570
debounce = true
function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then debounce = false h = Instance.new("Hat") p = Instance.new("Part") h.Name = "Headphones" p.Parent = h p.Position = hit.Parent:findFirstChild("Head").Position p.Name = "Handle" p.formFactor = 0 p.Size = Vector3.new(2, 1, 1) p.BottomSurface = 0 p.TopSurface = 0 p.Locked = true script.Parent.Mesh:clone().Parent = p h.Parent = hit.Parent h.AttachmentPos = Vector3.new(0, 0.3, 0) wait(5) debounce = true end end end) end)
script.Parent.Touched:connect(onTouched)
I'm trying to make a group hat giving script, so, when you join a game and your ID matches the group ID, you get the hat when ever you spawn every time you spawn. I'm new to LUA, so I'm not too far into scripting with LUA. I'm a Visual Basic and HTML... would this script work?
|
|
|
| Report Abuse |
|
|
3lex33
|
  |
| Joined: 08 Oct 2008 |
| Total Posts: 5220 |
|
|
| 12 Feb 2012 10:44 AM |
| Script seems ok, but why do you define GroupID, but never check if player group id is this one id? |
|
|
| Report Abuse |
|
|
Morvek
|
  |
| Joined: 19 Jul 2011 |
| Total Posts: 264 |
|
|
| 12 Feb 2012 10:45 AM |
| Good point - I'll get to working on it. |
|
|
| Report Abuse |
|
|
Morvek
|
  |
| Joined: 19 Jul 2011 |
| Total Posts: 264 |
|
|
| 12 Feb 2012 10:48 AM |
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) GroupID = 386570
debounce = true if player:IsInGroup(GroupID) then
function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then debounce = false h = Instance.new("Hat") p = Instance.new("Part") h.Name = "Desert Commander" p.Parent = h p.Position = hit.Parent:findFirstChild("Head").Position p.Name = "Handle" p.formFactor = 0 p.Size = Vector3.new(2, 1, 1) p.BottomSurface = 0 p.TopSurface = 0 p.Locked = true script.Parent.Mesh:clone().Parent = p h.Parent = hit.Parent h.AttachmentPos = Vector3.new(0, 0.3, 0) wait(5) debounce = true elseif not player:IsInGroup(GroupID) then p.Position = nil
end end end) end)
script.Parent.Touched:connect(onTouched)
That's the right one, correct? |
|
|
| Report Abuse |
|
|