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
 

How Do I Script A Award Badge When Touched Script

Previous Thread :: Next Thread 
ElectricJuggernaut is not online. ElectricJuggernaut
Joined: 31 May 2014
Total Posts: 676
18 Jul 2014 08:34 PM
Here is what I got? Am I right
local badgeId = 12345 --Badge ID
local awarded = true
script.Parent.Touched:connect(function(hit)
local plr = game.Players:FindPlayerFromCharacter(hit.Parent)
if awarded and plr then
game.BadgeService:AwardBadge(plr.userId,badgeId)

P.S Would I put the badge Id where it says badgeId at the last script line.
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
18 Jul 2014 08:45 PM
local BadgeId = 12345
local IsAwarded = true

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if IsAwarded == true then
game:GetService("BadgeService"):AwardBadge(player.userId, BadgeId)
end
end
end)
Report Abuse
ElectricJuggernaut is not online. ElectricJuggernaut
Joined: 31 May 2014
Total Posts: 676
18 Jul 2014 08:50 PM
Thank you.
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