Sk8erDan
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 4565 |
|
|
| 12 Sep 2017 08:16 PM |
how would I do it so a textlabel in a GUI shows a userdata statistic?
these are the stats:
sessionData[player] = {Credits = 0, Stops = 0}
i am not very good with userdata and just started, so i appreciate any help. |
|
|
| Report Abuse |
|
|
Sk8erDan
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 4565 |
|
| |
|
Sk8erDan
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 4565 |
|
|
| 12 Sep 2017 08:34 PM |
| wow scripters is very dead |
|
|
| Report Abuse |
|
|
|
| 12 Sep 2017 08:39 PM |
First, I would use a datastore for those values. Then I would do this.
CREDITSGUI.Text = player.stats.Credits.Value
|
|
|
| Report Abuse |
|
|
|
| 12 Sep 2017 08:43 PM |
since you're using a table, everything will be slightly different as compared to the method with int values involved
this is rather simple; all u need to do is just change the text into the specified object inside the table's value:
gui.Text = sessionData[player]["Credits"]
of course, you still need to define player, and get the data from the module script to the local script so it'd be:
local sessionData = require(--directory to the module script) local player = game.Players.LocalPlayer --using a local script since this involves guis
gui.Text = sessionData[player]["Credits"]
|
|
|
| Report Abuse |
|
|
Sk8erDan
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 4565 |
|
|
| 12 Sep 2017 08:57 PM |
i get the following error:
Players.Sk8erDan.PlayerGui.Hub.credits.TextLabel.LocalScript:4: attempt to index field '?' (a nil value) |
|
|
| Report Abuse |
|
|
Sk8erDan
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 4565 |
|
|
| 13 Sep 2017 03:02 PM |
| bump, i really need help with this. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2017 05:28 PM |
give us the entire script and we'll talk
|
|
|
| Report Abuse |
|
|