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 » Scripting Helpers
Home Search
 

Making a Team Hat Giver

Previous Thread :: Next Thread 
Morvek is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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