XL_z
|
  |
| Joined: 25 Jul 2016 |
| Total Posts: 20 |
|
|
| 02 Dec 2017 06:11 PM |
So, I'm a beginner at scripting and stuff. But I have encountered a strange error that says:
"00:04:59.729 - Players.XL_z.PlayerGui.ScreenGui.TextLabel.Script:2: attempt to index local 'points' (a number value)"
This is the outcome of this script I made:
local points = game.Players.LocalPlayer.leaderstats.Points.Value points:connect(function(IntValue) script.Parent.Text = "Points: "..points.Value end)
Trying to give my GUI the same value as my Leaderstats.
Help would be much appreciated, or you know, you can just say you're screwed. :)
-XL_z |
|
|
| Report Abuse |
|
|
XL_z
|
  |
| Joined: 25 Jul 2016 |
| Total Posts: 20 |
|
|
| 02 Dec 2017 06:12 PM |
| The IntValue within the function was just a test, wondering if that gave me a different outcome. |
|
|
| Report Abuse |
|
|
LuaCymru
|
  |
| Joined: 22 Jan 2015 |
| Total Posts: 394 |
|
|
| 02 Dec 2017 06:14 PM |
local points = game.Players.LocalPlayer:WaitForChild('leaderstats'):WaitForChild('Points')
points.Changed:connect(function() script.Parent.Text = "Points: "..points.Value end) |
|
|
| Report Abuse |
|
|
cabbler
|
  |
| Joined: 19 Jun 2015 |
| Total Posts: 735 |
|
|
| 02 Dec 2017 06:14 PM |
| "Connect" is a method for event signals. You can't use it on a number value. What you mean to do is connect Points.Changed |
|
|
| Report Abuse |
|
|
XL_z
|
  |
| Joined: 25 Jul 2016 |
| Total Posts: 20 |
|
|
| 02 Dec 2017 06:16 PM |
Omg, it worked. Thank you so much!
I also have another issue with the GUI, when the player dies (Which is supposed to happen) then GUI resets value, but the Leaderstats stay the same. When the user gains points it then adds onto the previous value, until the player dies again.
Again, you can just say "You're screwed" |
|
|
| Report Abuse |
|
|
Denny9876
|
  |
| Joined: 19 Oct 2012 |
| Total Posts: 117 |
|
|
| 02 Dec 2017 06:18 PM |
There's a property on the ScreenGui called "ResetOnSpawn", which resets the whole GUI to it's original state when the player respawns.
Just disable "ResetOnSpawn". :P |
|
|
| Report Abuse |
|
|
XL_z
|
  |
| Joined: 25 Jul 2016 |
| Total Posts: 20 |
|
|
| 02 Dec 2017 06:19 PM |
Okay, thank you and all, but you just made me feel really dumb and are forever ban! Jk Jk
Thank you so much! |
|
|
| Report Abuse |
|
|