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
|
  |
| 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
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 21 Apr 2017 01:16 AM |
Alright, thanks, I'll try it out.
|
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
| |
|
Inductive
|
  |
| Joined: 28 May 2012 |
| Total Posts: 6480 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 25 Apr 2017 02:07 AM |
I seemed to find the issue, thanks.
|
|
|
| Report Abuse |
|
|