I am trying to make a script that will make the first player who joins my game be able to walk faster. This is the code:
game.Players.PlayerAdded:Connect(function(player)
local plylist = {game.Players:GetPlayers()}
if plylist[2] == nil then
local onlyply = plylist[1]
game.Players.onlyply.character:FindFirstChild("Humanoid").WalkSpeed = 150
end
end)
However, when ever I run this, Roblox gives me this error...
'onlyply is not a valid member of Players "Players"'
Can someone tell me what am I doing wrong and how to I fix this?

2 comments
In line 9 you are searching onlyply in game.Players which does not exists. Since you already have onlyply set as a variable you can just delete the game.Players in line 9 and it should run
It worked! Thanks. That helped a lot.