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: Return player value

Previous Thread :: Next Thread 
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
01 Jun 2016 04:15 AM
I feel like a complete noob.

elseif command == 'Kill' then
return game.Players.LocalPlayer.leaderstats.Fame

Output says something that attempt to index field 'LocalPlayer' (a nil value).

I need it to return the leaderstats.Fame.Value
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
01 Jun 2016 04:19 AM
Is this running from a local script?


Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
01 Jun 2016 04:24 AM
Yes.
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
01 Jun 2016 04:28 AM
Post the whole script and the actual error message.


Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
01 Jun 2016 04:29 AM
Server script inside ServerScriptService that takes remote functions and does something in return.
-------------------------------------------------------------------

function game.ReplicatedStorage.Command.OnServerInvoke(p, player, command)
if command == 'Kill' then
return game.Players.LocalPlayer.leaderstats.Fame.Value
end;
end;

-------------------------------------------------------------------

Parts of local script that could be a cause:

-------------------------------------------------------------------

player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent
fame = remote:InvokeServer(player, 'Kill')
LevelofUnlock = 0


if fame.Value >= LevelofUnlock and not CheckPack:FindFirstChild("Carbine") then

________________________________________________________________________________

Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
01 Jun 2016 04:30 AM
...Ok, so it was actually NOT running from a local script.

function game.ReplicatedStorage.Command.OnServerInvoke(p, player, command)
if command == 'Kill' then
return player.leaderstats.Fame.Value
end
end


Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
01 Jun 2016 04:30 AM
Client error
-----------------------------------------------------
12:29:04.296 - ServerScriptService.Script:8: attempt to index field 'LocalPlayer' (a nil value)
12:29:04.298 - Script 'Players.Player1.PlayerGui.EquipmentGui1.Main.OpenButton.PrimaryWeapons.AssualtRifles.AssualtRifles.ACR 6.8.Unlock', Line 4
12:29:04.298 - Stack End

-----------------------------------------------------

Server error
-----------------------------------------------------
12:29:04.212 - ServerScriptService.Script:8: attempt to index field 'LocalPlayer' (a nil value)
12:29:04.212 - Stack Begin
12:29:04.213 - Script 'ServerScriptService.Script', Line 8
12:29:04.213 - Stack End
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
01 Jun 2016 04:31 AM
or actually p.leaderstats.Fame.Value


Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
01 Jun 2016 04:34 AM
Great! You've fixed one issue. Now there is another:
--------------------------------------------------------

if fame.Value >= LevelofUnlock and not CheckPack:FindFirstChild("Carbine") then


--------------------------------------------------------
12:32:57.050 - Players.Player1.PlayerGui.EquipmentGui1.Main.OpenButton.PrimaryWeapons.AssualtRifles.AssualtRifles.ACR 6.8.Unlock:9: attempt to index global 'fame' (a number value)
12:32:57.051 - Stack Begin
12:32:57.052 - Script 'Players.Player1.PlayerGui.EquipmentGui1.Main.OpenButton.PrimaryWeapons.AssualtRifles.AssualtRifles.ACR 6.8.Unlock', Line 9
12:32:57.052 - Stack End

Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
01 Jun 2016 04:35 AM
Aaaahh I'm stupid, stupid. I forgot to remove .Value
I've made it accidentaly check Value.Value
Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
01 Jun 2016 04:36 AM
Thank you kind sir. You've saved another life today!
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