local Players = game:GetService("Players")
local playerList = Players:GetPlayers()
wait(95)
local random = math.random(1, #game.Players:GetPlayers())
print(random)
randomplayer = playerList[random]
wait(5)
print(randomplayer)
local text = script.Parent
text.Text = (randomplayer.Name.." is on today's menu")
--It works here though, so I am really confused...:
local Players = game:GetService("Players")
local playerList = Players:GetPlayers()
wait(25)
script.Parent.ImageLabel.Visible = true
script.Parent.TextLabel.Visible = true
script.Parent.TextLabel.Text = "Guys, I think we are trapped in here now!"
local random = math.random(1, #game.Players:GetPlayers())
randomplayer = playerList[random]
wait()
print(randomplayer)
script.Parent.ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..randomplayer.Name
wait(10)
script.Parent.ImageLabel.Visible = false
script.Parent.TextLabel.Visible = false
script.Parent.TextLabel.Text = ""
Can someone explain to me what I am doing wrong in this gui code? It is generating the random number, but saying the player is nil.. This code works in one script, but not another, so I am really confused. I have stared at this code until I am going blind. I am sure it is something obvious and I am not seeing it. LOL

6 comments
Please put your code in a code block
^
^
Oh thank you InfinityDesign! Duh LOL
Does help if you mark the answer as accepted. I get clout & anyone with the same problem in the future has an easier way of seeing how to solve it. <3
Oh okay, I did, sorry, that was my first post in here. I didn't know.