Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 

2 comments

0

Please put your code in a code block. ;)

0

There you go.

1 answer

✓ Accepted answer

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.

3 comments

0

lol

0

Wow. Thanks.

0

XD

This discussion is preserved as it was. New answers, comments, and votes are closed.