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 » Scripters
Home Search
 

Re: How to increase the total score of a team if a person dies

Previous Thread :: Next Thread 
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
12 Oct 2015 10:06 PM
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()

if player.TeamColor==BrickColor.new("Storm blue") then
_G.Rangers_score=_G.Rangers_score+1
end
if player.TeamColor==BrickColor.new("Moss") then
_G.Moondarkers_score=_G.Moondarkers_score+1
end

--print(player.Name .. " has died!")
end)
end)
end)
game.StarterGui.ScreenGui["Team score"].TextLabelMOONDARKERS.Text=("Moondarkers:").._G.Moondarkers_score
game.StarterGui.ScreenGui["Team score"].TextLabelRANGERS.Text=("Rangers:").._G.Rangers_score
Report Abuse
Dogejia is not online. Dogejia
Joined: 08 Feb 2012
Total Posts: 1873
12 Oct 2015 10:10 PM
If its on the leaderboard, something like

ValueNameHere.Value=ValueNameHere.Value+num


gcmi lg lpxtlc; Decode it with Vigenere Cipher, keyword is Doge, if you dare >:)
Report Abuse
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
12 Oct 2015 10:15 PM
It's a text label gui.
Report Abuse
Dogejia is not online. Dogejia
Joined: 08 Feb 2012
Total Posts: 1873
12 Oct 2015 10:15 PM
Do you have an INT, or any value?


gcmi lg lpxtlc; Decode it with Vigenere Cipher, keyword is Doge, if you dare >:)
Report Abuse
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
12 Oct 2015 10:16 PM
no
Report Abuse
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
12 Oct 2015 10:19 PM
should i add an intValue ?
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
12 Oct 2015 10:20 PM
Only if you're using the built in leaderboard system.

-The [Guy]
Report Abuse
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
12 Oct 2015 10:28 PM
oh.
Im using a gui. So how would I fix my code if I wasn't using a leaderboard.
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
12 Oct 2015 10:55 PM
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
if player.TeamColor.Name == "Storm blue" then
_G.Rangers_score = _G.Rangers_score + 1
end
if player.TeamColor.Name == "Moss" then
_G.Moondarkers_score = _G.Moondarkers_score + 1
end
updateLeaderboard()
end)
end)
end)

function updateLeaderboard()
for _, player in next, game.Players:GetPlayers() do
if player.StarterGui:FindFirstChild("ScreenGui") then
player.StarterGui.ScreenGui["Team score"].TextLabelMOONDARKERS.Text = "Moondarkers: " .. _G.Moondarkers_score
player.StarterGui.ScreenGui["Team score"].TextLabelRANGERS.Text = "Rangers: " .. _G.Rangers_score
end
end
end

This really isn't an efficient way to do things but it should work. I didn't make it better because I don't know how your system is set up.

-The [Guy]
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
12 Oct 2015 10:58 PM
Ahhhhh wait I had a brainfart, I said StarteGui instead of PlayerGui lol. Replace updateLeaderboard() with this function

function updateLeaderboard()
for _, player in next, game.Players:GetPlayers() do
if player.PlayerGui:FindFirstChild("ScreenGui") then
player.PlayerGui.ScreenGui["Team score"].TextLabelMOONDARKERS.Text = "Moondarkers: " .. _G.Moondarkers_score
player.PlayerGui.ScreenGui["Team score"].TextLabelRANGERS.Text = "Rangers: " .. _G.Rangers_score
end
end
end

-The [Guy]
Report Abuse
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
12 Oct 2015 11:46 PM
for some reason that code does not work for me.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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