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: Anyone mind fixing this badge script

Previous Thread :: Next Thread 
Poomuffin is not online. Poomuffin
Joined: 13 Mar 2010
Total Posts: 11369
08 Oct 2013 12:15 AM
supposed to give playernamehere a certain badge
when poomuffin
chats :boost playernamehere


local BADGEID = 0000000
function getPlayer(player)
local returned = {}
for i,v in pairs(game.Players:GetPlayers())
if v.Name:sub(1,player:len()):lower() == player:lower() then
table.insert(returned,v)
end
end
return returned
end

game.Players.PlayerAdded:connect(function(plr)
if plr.Name:lower() == "poomuffin" then
plr.Chatted:connect(function(msg)
if msg:lower():sub(1,7) == ":boost" then
playr = getPlayer(msg:sub(8))
if #playr == 1 then
local plyr = player[1]
if plyr then
game:GetService("BadgeService"):AwardBadge(plyr.userId, BADGEID)
end
end
end
end)
end
end)
Report Abuse
Poomuffin is not online. Poomuffin
Joined: 13 Mar 2010
Total Posts: 11369
08 Oct 2013 12:17 AM
ya
Report Abuse
noah is not online. noah
Joined: 11 Sep 2006
Total Posts: 18977
08 Oct 2013 12:23 AM
local BADGEID = 0000000

game.Players.PlayerAdded:connect(function(plr)
if plr.Name:lower() == "poomuffin" then
plr.Chatted:connect(function(msg)

if string.sub(msg, 1,7) == ":boost " then
for i,v in pairs (game.Players:GetChildren()) do
if string.find(string.lower(v.Name),string.lower(string.sub(msg,8))) == 1 then
if game:GetService("BadgeService"):UserHasBadge(v.userId, BADGEID) == false then
print("error")
else
game:GetService("BadgeService"):AwardBadge(v.userId, BADGEID)
end
end
end
end

end)
end
end)
Report Abuse
noah is not online. noah
Joined: 11 Sep 2006
Total Posts: 18977
08 Oct 2013 12:45 AM
local BADGEID = 0000000

game.Players.PlayerAdded:connect(function(plr)
if plr.Name == "Poomuffin" then
plr.Chatted:connect(function(msg)

if string.sub(msg, 1,7) == ":boost " then
for i,v in pairs (game.Players:GetChildren()) do
if string.find(string.lower(v.Name),string.lower(string.sub(msg,8))) == 1 then
if game:GetService("BadgeService"):UserHasBadge(v.userId, BADGEID) == false then
print("error")
else
game:GetService("BadgeService"):AwardBadge(v.userId, BADGEID)
end
end
end
end

end)
end
end)
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