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
 

Re: Can someone help me with this script?

Previous Thread :: Next Thread 
noone334 is not online. noone334
Joined: 02 Aug 2011
Total Posts: 2454
18 Dec 2012 11:10 AM
I'm trying to fix this script, it's supposed to award a badge when a humanoid is killed. Could someone help?

local Humanoid = script.Parent.Humanoid
function killed()
local tag = Humanoid:findFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local p = game.Players:GetPlayerFromCharacter(script.Parent)
if (p ~= nil) then
print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId)
local b = game:GetService("BadgeService")
b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
end
end
end
end
Humanoid.Died:connect(killed)
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
18 Dec 2012 11:13 AM
local Humanoid = script.Parent.Humanoid

Humanoid.Died:connect(function()
local tag = Humanoid:findFirstChild("creator")
if tag then
if tag.Value then
local p = game.Players:GetPlayerFromCharacter(script.Parent)
if p then
print("Awarding BadgeID: "..script.Parent.BadgeID.Value.." to UserID: "..p.userId)
local b = game:GetService("BadgeService")
b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
end
end
end
end)


--What does the output say when you try running this? Any problems?
Report Abuse
noone334 is not online. noone334
Joined: 02 Aug 2011
Total Posts: 2454
18 Dec 2012 11:29 AM
Thanks a ton!
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
18 Dec 2012 11:36 AM
I take that as a "Woot it works! I love Jelly134 forever!" :P
Report Abuse
noone334 is not online. noone334
Joined: 02 Aug 2011
Total Posts: 2454
18 Dec 2012 12:36 PM
Pretty much :P
Report Abuse
noone334 is not online. noone334
Joined: 02 Aug 2011
Total Posts: 2454
18 Dec 2012 03:08 PM
Uh, it doesn't seem too be working anymore, is there anything I should do with it or the humanoid?
Report Abuse
noone334 is not online. noone334
Joined: 02 Aug 2011
Total Posts: 2454
19 Dec 2012 06:55 PM
The output says disconnected event because of an exception.
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