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: attempt to compare number with userdata

Previous Thread :: Next Thread 
catnip6362 is not online. catnip6362
Joined: 23 Nov 2008
Total Posts: 438
19 Jun 2015 12:10 AM
It still says: Players.Player1.PlayerGui.ScreenGui.bankframe.1000takeoff.L:8: attempt to compare number with userdata

what I've done false?

script:

player = game.Players.LocalPlayer
playername = player.Name
money = player.leaderstats.money.Value
bankvalue = player.bankvalue
b = 1000

script.Parent.MouseButton1Click:connect (function()
if money >= b then do
bankvalue = bankvalue +b
money = money -b
end
end
end)


Report Abuse
DrSaint is not online. DrSaint
Joined: 14 Oct 2009
Total Posts: 18429
19 Jun 2015 12:18 AM
Was b previous defined as something?
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
19 Jun 2015 12:23 AM
when you're defining the money variable and you make it point to a property, it will not change with the property.
Instead, define money as;
money = player.leaderstats.money
and when you need to read the money value, do
money.Value,
when you need to edit it,
money.Value (+/-/other operators) #--numbers lol

as far as the connections
you have an extra end

i've explained enough, i'll fix it lol

player = game.Players.LocalPlayer
playername = player.Name
money = player.leaderstats.money
bankvalue = player.bankvalue
b = 1000

script.Parent.MouseButton1Click:connect(function()
if money >= b then
bankvalue.Value = bankvalue.Value+b
money.Value = money.Value-b
end
end)

-=Robo=-
Report Abuse
catnip6362 is not online. catnip6362
Joined: 23 Nov 2008
Total Posts: 438
19 Jun 2015 12:33 AM



Thanks!
Report Abuse
DrSaint is not online. DrSaint
Joined: 14 Oct 2009
Total Posts: 18429
19 Jun 2015 12:34 AM
Dang. I wasn't even close. I knew it had to do with a value though.

Getting better doe.
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
19 Jun 2015 12:35 AM
don't try to use that, i messed up
--change the connection to;
script.Parent.MouseButton1Click:connect(function()
if money.Value >= b then
bankvalue.Value = bankvalue.Value+b
money.Value = money.Value-b
end
end)

-=Robo=-
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