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: GUI Text isn't changing...

Previous Thread :: Next Thread 
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
15 Nov 2012 04:35 PM
I'm making a script where the full leaderstats of each team, and when I tested it, it isn't working. I'm also not sure about lines 6 and 12, as this is my first time with the entire team leaderstats thing.
teamStat1 = 0
teamStat2 = 0
while true do
for i,v in pairs ( game.Players:GetPlayers ( ) )
if v.TeamColor == "Bright red" then
teamStat1 = v.leaderstats.Points + teamStat1
end
end

for i,v in pairs ( game.Players:GetPlayers ( ) )
if v.TeamColor == "Bright blue" then
teamStat2 = v.leaderstats.Points + teamStat2
end
end
script.Parent.Blue.Text = "Blue: "..teamStat2
script.Parent.Red.Text = "Red: "..teamStat1
wait(0.001)
end
Report Abuse
michaelaqz4 is not online. michaelaqz4
Joined: 23 Sep 2009
Total Posts: 1940
15 Nov 2012 04:38 PM
script.Parent.Blue.Text = "Blue: "..teamStat2..""
script.Parent.Red.Text = "Red: "..teamStat1..""
Report Abuse
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
15 Nov 2012 04:40 PM
Didn't help.
Report Abuse
michaelaqz4 is not online. michaelaqz4
Joined: 23 Sep 2009
Total Posts: 1940
15 Nov 2012 04:42 PM
teamStat1 = 0 --Is 0
teamStat2 = 0 -- Is 0
while true do
for i,v in pairs ( game.Players:GetPlayers ( ) )
if v.TeamColor == "Bright red" then
teamStat1 = v.leaderstats.Points + teamStat1 -- Is adding 0...LolWut
end
end

for i,v in pairs ( game.Players:GetPlayers ( ) )
if v.TeamColor == "Bright blue" then
teamStat2 = v.leaderstats.Points + teamStat2 -- Is adding 0...LolWut
end
end
script.Parent.Blue.Text = "Blue: "..teamStat2..""
script.Parent.Red.Text = "Red: "..teamStat1..""
wait(0.001)
end
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
15 Nov 2012 04:48 PM
@michael

That makes no difference.

What you are doing is adding zero, then displaying zero, so what are you trying to accomplish?

¤¤ †KMXD† ¤¤
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
15 Nov 2012 04:49 PM
Never mind about displaying zero, what are you trying to do, and what's not working.

¤¤ †KMXD† ¤¤
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
15 Nov 2012 04:53 PM
Hm, try this:

    local teamStat1 = 0
    
    local teamStat2 = 0
    
    while wait() do
      for i, v in pairs(Game.Players:GetPlayers()) do
        if v.TeamColor == BrickColor.new("Bright red") then
          teamStat1 = teamStat1 + v.leaderstats.Points
        elseif v.TeamColor == BrickColor.new("Bright blue") then
          teamStat2 = teamStat2 + v.leaderstats.Points
        end
      end
      script.Parent.Blue.Text = "Blue: " .. teamStat2
      script.Parent.Red.Text = "Red: " .. teamStat1
    end

¤¤ †KMXD† ¤¤
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
15 Nov 2012 04:55 PM
It probably isn't ideal actually. . . Just add to the Blue/Red team's score every time they kill, in the weapon's script, rather than use a loop. It will constantly add everyone's number.

¤¤ †KMXD† ¤¤
Report Abuse
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
15 Nov 2012 05:24 PM
In that case, will this work?

b = game.Players:GetChildren()
for i = 1, #b do
if b[i]:FindFirstChild("leaderstats") ~= nil then
c = b[i].leaderstats.Points
c[i].Value.Changed:connect(function()
if c[i].Parent.Parent.TeamColor == BrickColor.new("Bright blue")
script.Parent.Blue.Text = "Blue: "..c.Value
else
script.Parent.Red.TExt = "Red: "..c.Value
end
end)
end
end
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
15 Nov 2012 05:26 PM
U R KIDDING ME???

I give you my script then you mess it up...

It's TeamColor.Name == "NAME OF THE FIRETTRUKCING BRICKCOLOR"
Report Abuse
glosgreen2 is not online. glosgreen2
Joined: 06 Jul 2009
Total Posts: 1303
15 Nov 2012 05:48 PM
Remove the wait function, it's basically redundant at the time you've set it to and is probably not worth being there and get rid of all those spaces around the brackets. (It may be the problem).
Report Abuse
thumper10 is not online. thumper10
Joined: 17 Apr 2009
Total Posts: 3304
15 Nov 2012 05:53 PM
@XxChopSlapperxX
You didn't make it. Please stop spamming or I will report you.

- thumper10, C# Lover
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
15 Nov 2012 06:06 PM
@thumper, yes I did.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
15 Nov 2012 06:07 PM
He edited the sample I made for him, he edited the wrong part though...


http://www.roblox.com/Forum/ShowPost.aspx?PostID=82082033
Report Abuse
glosgreen2 is not online. glosgreen2
Joined: 06 Jul 2009
Total Posts: 1303
15 Nov 2012 06:13 PM
You didn't *invent* the script though because you joined in 2010. I joined in 2007 and was using that type of scripting in 2009.
Report Abuse
nrscsy is not online. nrscsy
Joined: 09 Nov 2012
Total Posts: 465
15 Nov 2012 06:19 PM
Going by that, nobody has ever invented any script, since the original language coder set the scripts and everybody else just used his methods.
Report Abuse
glosgreen2 is not online. glosgreen2
Joined: 06 Jul 2009
Total Posts: 1303
15 Nov 2012 06:22 PM
Exactly. >=3
lol.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
15 Nov 2012 06:23 PM
Make no sense..
Report Abuse
glosgreen2 is not online. glosgreen2
Joined: 06 Jul 2009
Total Posts: 1303
15 Nov 2012 06:28 PM
If you insist.
Vivid gig ion geek jeokdqe jewel key laser legit Lyon ohiuf get other our hmrc July.

Happy?
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