|
| 11 Jun 2017 01:27 PM |
Hello, I am doing a race randomizer for my rpg. It works perfectly fine when running the studio on solo but I get the following error whenever I run a test : ---------------------------------------------------------------------------------------- 14:15:49.778 - Players.Player1.Backpack.RandomRace:7: attempt to index global 'Player' (a nil value) ----------------------------------------------------------------------------------------
This is the part of my script it's reffering to (The "if" statement): ---------------------------------------------------------------------------------------- wait(2)
Player = game.Players.LocalPlayer
if not(Player.RaceChosen.Value) then print("Randomizing Race...") GeneratedRarity = math.random(1,100) ----------------------------------------------------------------------------------------
From what I understand, this would mean that "Player" does not exist.
I'm quite new at Lua, still learning, but I can't grasp on what I'm doing wrong here. Do you guys have any ideas?
Thanks in advance! Crypto |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2017 01:28 PM |
| That's an LocalScript or Script? |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2017 01:30 PM |
Hey, thanks for the fast reply!
It is a Script. |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2017 01:34 PM |
Just changed to a LocalScript, it appears to be working!
Thanks a lot! |
|
|
| Report Abuse |
|
|
| |
|