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: Is this script broken?

Previous Thread :: Next Thread 
XL_z is online. 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 is online. 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 is not online. 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 is not online. 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 is online. 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 is online. 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 is online. 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
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