Why is the argument always returning nil?

For some really strange reason in the portion of my script that returns data to other scripts, it always says the “Player” argument is nil even if it is called with the area filled.

function module.Get(p)
	print(p.Name)
	local profile = Profiles[p]
	if profile then
		print("yeah")
		return profile
	else
		return module.WaitForProfile(p)
	end
end

This is the portion in the data module

and here is the other part in the loading script

local ProfileService = require(game.ServerScriptService.DataApi)

Players.PlayerAdded:Connect(function(Player)
	print(Player.Name)
	local profile = ProfileService.Get(Player)
	

Can you show how you are making your table? You might have an inconsistent index.

I just now fixed it and it was the dumbest thing…

1 Like

I hold onto a draft request for help sometimes for hours hoping I find something dumb… :joy:

1 Like

I’m having the same issue! Mind me asking what your solution was?

There are multiple ways to get to player, depending on what you are starting with. I almost always start from character, so I use:

local Players = game:GetService(“Players”)
player = Players:GetPlayerFromCharacter(char)

What code are you trying to fix?

I found the issue. I was calling my module functions using : instead of a .
For some reason that was making all the arguments return nil. Thanks, though?

1 Like