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: What's wrong with this script?

Previous Thread :: Next Thread 
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 05:05 PM
function onPlayerEntered(newPlayer)

script.Parent.Text = "Gold: " ..game.Players.newPlayer.leaderstats.Gold.Value

end

game.Players.ChildAdded:connect(onPlayerEntered)


It's supposed to display the amount of gold that a player has in a GUI.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Sep 2014 05:15 PM
Try using this in a LocalScript (yes, this is the entire script):

script.Parent.Text = "Gold: " ..game.Players.LocalPlayer.leaderstats.Gold.Value
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 05:23 PM
That didn't seem to work.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Sep 2014 05:26 PM
What is the output saying?
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 05:30 PM
leaderstats is not a valid member of Player


Yet I just checked, and when I do a test run it indeed shows up in under Player.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
30 Sep 2014 05:30 PM
function onPlayerEntered(newPlayer)

script.Parent.Text = "Gold: " ..newPlayer.leaderstats.Gold.Value

end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 05:40 PM
@eLun, nope. :c
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 05:49 PM
Bump
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
30 Sep 2014 05:52 PM
Try using PlayerAdded, and then use newPlayer:WaitForChild("leaderboard"):WaitForChild("Gold").Value
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 05:54 PM
So what would that look like?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
30 Sep 2014 05:58 PM
function onPlayerEntered(newPlayer)

script.Parent.Text = "Gold: " ..newPlayer:WaitForChild("leaderstats"):WaiForChild("Gold").Value

end

game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 06:42 PM
...Nope qq
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 07:04 PM
Bump

Ugh, anyone else want to try to help?
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 08:19 PM
:/
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
30 Sep 2014 08:56 PM
eeeeeeeeeeeeeeeeeeeeee
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Sep 2014 11:58 PM
How about this (LocalScript)?

local stat = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Gold")
script.Parent.Text = stat.Value
stat.Changed:connect(function()
script.Parent.Text = stat.Value
end
Report Abuse
Temprist is not online. Temprist
Joined: 28 Aug 2010
Total Posts: 10060
01 Oct 2014 04:33 PM
Still no.
Whatever, I suppose I'll try again later.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
01 Oct 2014 05:51 PM
I forgot a ")" sorry.

local stat = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Gold")
script.Parent.Text = stat.Value
stat.Changed:connect(function()
script.Parent.Text = stat.Value
end)

By the way, it should be in the TextLabel that is displaying the points.
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