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: I'm stumped. FE

Previous Thread :: Next Thread 
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
28 Feb 2016 03:02 PM
'Attempt to compare number with nil'

The error I'm getting from the client. Here's the RemoteFunction's script, which is in the Workspace. When I add a print in here it runs, if I put the print in the if statement it doesn't run. 'player' is a non-nil string containing the player's name. And in the server storage there is a folder that's named the player's name. And I even checked it myself -- That folder isn't nil! So why isn't this code running? It's a server script, so it should have access to ServerStorage.. FE is on.

wait()
function script.Parent.OnServerInvoke(player) --Used to get the player's cash.
local money = game.ServerStorage:FindFirstChild(player)
if money then
return money.Cash.Value
end
end
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
28 Feb 2016 03:08 PM
LOL.

local money = game.ServerStorage:FindFirstChild(player)
print(game.ServerStorage.Player.Name)
if money then
return money.Cash.Value
end


It doesn't print nil, but for some reason money is nil. explanation pls
Report Abuse
WolfgangVonPrinz is not online. WolfgangVonPrinz
Joined: 24 Oct 2013
Total Posts: 4656
28 Feb 2016 03:09 PM
Do print(money), wouldn't be surprised if that was the problem. Also, make a custom waitforchild function, and replace it with findfirstchild (It's useful in a lot of contexts)
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
28 Feb 2016 03:10 PM
I did that, as I already stated. And it prints 'Player' (The name of the player, it isn't a instance, it's a string. I double-checked)


Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
28 Feb 2016 03:12 PM
Does FindFirstChild not work with FE? This or some other thing I never knew didn't work with FE.
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
28 Feb 2016 03:14 PM
game.ServerStorage:FindFirstChild(player.Name)
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
28 Feb 2016 03:15 PM
player is a String. Not an object.
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
28 Feb 2016 03:18 PM
No its not.
http://wiki.roblox.com/index.php?title=API:Class/RemoteFunction/OnServerInvoke
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
28 Feb 2016 03:20 PM
Wow gg. I was actually sending over the player's name cause I thought it didn't automatically send the player over. Thanks.
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