Attempt to call a nil value with players problem

No idea why this is happening, here is an example of my code

-- Create Replay For Existing Players
for _, v in ipairs(game.Players:GetPlayers()) do
	createReplay(v) -- error is here "attempt to call a nil value"
end

function createReplay(Player : Player) -- I've tired removing : Player
	-- rest of code here
end

I’ve tried stuff like game.Players:FindFirstChild(tostring(v.Name)) and everything I can think of. (waiting for player to load in, etc)

Is createReplay defined above your call to it? luau is a serial language so if you call it before it’s defined it’s a nil reference

2 Likes

I’m going to act like I totally just didn’t do that and mark this as the solution.

2 Likes