Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why do I have an index global error in my script?

Asked by 7 years ago
Edited 7 years ago

Line 16 says "attempt to index global 'PEScaptain' (a nil value)

Script:

repeat wait() until game.Players.NumPlayers >= 2 

wait(3) 
local PESmembers = game.Teams:WaitForChild("PES"):GetPlayers() 
local FIFAmembers = game.Teams:WaitForChild("FIFA"):GetPlayers() 
local tool = game.ReplicatedStorage.Select

local PEScaptain = PESmembers[math.random(#PESmembers)] 
wait(1)
local FIFAcaptain = FIFAmembers[math.random(#FIFAmembers)]
print(PEScaptain.Name.." has been selected as the PES captain!!") 
 wait(1) 
print(PEScaptain.Name.." has been selected as the FIFA captain!!")

game.ReplicatedStorage["Select"]:Clone().Parent = PEScaptian.PlayerGui 
game.ReplicatedStorage["Select"]:Clone().Parent = FIFAcaptian.PlayerGui 
0
Please put your code in a code block. ;) TheeDeathCaster 2368 — 7y
0
There you go. comotose 3 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

I have to admit, this is really funny i LMBO. I'm sorry to say this, but you spelled PEScaptain wrong.

You: PEScaptian

Stored Info: Pescaptain.

You also spelled FIFAcaptain wrong.

You: FIFAcaptian

Stored Info: FIFAcaptain.

0
lol UnreadyHappiness 35 — 7y
0
Wow. Thanks. comotose 3 — 7y
0
XD UnreadyHappiness 35 — 7y
Ad

Answer this question