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: Is this small script right?

Previous Thread :: Next Thread 
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 09:42 AM
local BadgeID = 135933219 --Badge ID Here

local HowMuch = 8

game.Players.PlayerAdded:connect(function(p)

repeat wait() until p:findFirstChild("leaderstats") ~= nil

p.leaderstats["KOs"].Changed:connect(function()

if p.leaderstats["KOs"].Value == HowMuch then
game:GetService("BadgeService"):AwardBadge(p.userId, BadgeID)
script.Sound:play()
else
return end

end)

end)
Report Abuse
Vaporation is not online. Vaporation
Joined: 08 Jun 2011
Total Posts: 1397
19 Nov 2013 09:43 AM
Yea this is a small script.
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 09:44 AM
Do you know how and where to add a line where you make it that if you're in the team (in the game) "Pilgrims" you get the badge?
(If you have 8KOs and IN that team).
Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
19 Nov 2013 09:49 AM
yes you lrn 2 skript
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 09:55 AM
Can anyone help me with my question?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
19 Nov 2013 10:05 AM
if (p.TeamColor == game.Teams.Pilgrims.TeamColor) then
-- Give them the badge
end

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 10:17 AM
Thank you DaMrNelson.

And just to make sure, would it be like that (when adding that part):


local BadgeID = 135933219 --Badge ID Here

local HowMuch = 8

game.Players.PlayerAdded:connect(function(p)

repeat wait() until p:findFirstChild("leaderstats") ~= nil

p.leaderstats["KOs"].Changed:connect(function()

if p.leaderstats["KOs"].Value == HowMuch then
if (p.TeamColor == game.Teams.Pilgrims.TeamColor) then
game:GetService("BadgeService"):AwardBadge(p.userId, BadgeID)
script.Sound:play()
else
return end

end
end)
end)




Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
19 Nov 2013 10:21 AM
omg he is lrning :O
I thought he would just ask you to fix his free model
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
19 Nov 2013 10:26 AM
@Scriptual
Haha oh well :3

@OP
You don't need the "else return end" part. Simply leaving out the "else" part (but you still need that end) will work, and it takes less time to type.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
19 Nov 2013 10:29 AM
Why does he still need the end? I only see 3 things that need a end
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 10:32 AM
Scriptural, I'm not a good scripter, but I'll be learning when I'll have free time.
I'm a partner in 4Sci's project - Thanksgiving Game (Capture the Flags), and I was asked to handle the badge scripts.

I don't just give something and hope people will fix it.

I just expect for a small help from a good scripters.
(XAXA and others are offline, so the only thing last is to ask in the forums).
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
19 Nov 2013 10:32 AM
I was making sure that he understood that if he took out the "else return end" part, he'd need to add a new "end" to replace the "end" he took out...
It probably would have just been simpler to say "you can just replace the 'else return' part" .-.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 10:32 AM
From good scripters.*
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 10:37 AM
Sorry for bothering over and over.

But I made it like this:

--

local BadgeID = 135933219
local HowMuch = 8

game.Players.PlayerAdded:connect(function(p)
p:WaitForDataReady()
repeat wait() until p:findFirstChild("leaderstats")
p.leaderstats:WaitForChild("KOs").Changed:connect(function(value) --it was 'KOs', right?
if p.TeamColor == game.Teams.TeamNameHere.TeamColor then -- the line I changed
if value == HowMuch then
game:GetService("BadgeService"):AwardBadge(p.userId, BadgeID)
script.Sound:play()
end
end
end)
end)

--

(Pretty same)

Is it okay?
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 10:38 AM
Ignore the comments "it was 'KOs', right?" or "the line I changed".
Those are for me.
Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
19 Nov 2013 10:42 AM
why not you test it
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 10:43 AM
It's not my game, I'm not BC (I can't sell badges), and the game owner is offline, I can't test it in no any way. Asking someone will just fail.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
19 Nov 2013 10:45 AM
From looking it over, it seems that that would work.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
odedelisha is not online. odedelisha
Joined: 31 Dec 2010
Total Posts: 3020
19 Nov 2013 10:48 AM
Okay, thanks a lot!
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