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: Need help, not an advance scripter

Previous Thread :: Next Thread 
ChadZer is online. ChadZer
Joined: 14 Dec 2010
Total Posts: 653
21 Apr 2017 12:55 AM
txtwood = game.StarterGui.StatsGui.FrameStats.LblWood.Text

function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = 0

local wood = Instance.new("IntValue")
wood.Name = "Wood"
wood.Value = 0

local stone = Instance.new("IntValue")
stone.Name = "Stone"
stone.Value = 0

cash.Parent = stats
wood.Parent = stats
stone.Parent = stats
stats.Parent = newPlayer

end
game.Players.ChildAdded:connect(onPlayerEntered)

If I have this script, how can I make those stats show in a GUI textlabel?
Like if I have 8 Wood, it'll show 8 wood in my GUI, almost like an inventory.


Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
21 Apr 2017 01:11 AM
Alright, so you're going to want to put the "stats" somewhere accessible, maybe make a folder labeled "PlayerStats" then add stats as subfolders and give stats the name of the player for easier access.

Well, however you do it, once you've got a way to access it you'll want to set up a local script to change the textvalue of a Gui to whatever the stats that you want it to be.

So if cash changes, in the local script it'll fire
cash.Changed:connect(function()
PlayerGui.CashGui = cash.Value
end)

Basically.

Granted, what I wrote won't work, you have to actually put in the TextGui or whatever for it to work, so be prepared for that. Just repeat it for each value and you should be good to go.

Googling Roblox.changed and Roblox Guis should help you a lot as well.
Report Abuse
ChadZer is online. ChadZer
Joined: 14 Dec 2010
Total Posts: 653
21 Apr 2017 01:16 AM
Alright, thanks, I'll try it out.


Report Abuse
ChadZer is online. ChadZer
Joined: 14 Dec 2010
Total Posts: 653
21 Apr 2017 01:49 AM
It worked, thanks.


Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
21 Apr 2017 01:55 AM
You're welcome.
Report Abuse
ChadZer is online. ChadZer
Joined: 14 Dec 2010
Total Posts: 653
21 Apr 2017 04:07 PM
Uh, so it worked in studio, but not in an actual server.


Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
24 Apr 2017 01:36 AM
From the first line it seems to me that you're altering the starter gui itself, which means that you would only actually see the changes if you reset.

You don't want to alter the starter gui text values, you want to alter the playergui values, so you have to get the playergui from each player.

game.Players.LocalPlayer.PlayerGui[Whatever you've got your Gui named as]

would be your first step, then you'd get the other guis from that.

Report Abuse
ChadZer is online. ChadZer
Joined: 14 Dec 2010
Total Posts: 653
25 Apr 2017 02:07 AM
I seemed to find the issue, thanks.


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