I am trying to code an ability system. When the player first joins, I create a folder inside a folder inside of server storage. This folder that I just create is named after the player.
ServerStorage -> SelectedAbilities -> Player one
In a script stored under ServerScriptService, I try to call upon it when the buttons "Q" and "E" are pressed. Here is my current code for when this happens.
local selectedAbilities = game.ServerStorage:FindFirstChild("SelectedAbilities")
local plrObject = selectedAbilities:FindFirstChild(player)
abNumb = plrObject.Ability2.Value
ab = abModule.AbilityReturn(abNumb)
print("Ability2 = "..ab)
The issue is that plrObject, the variable, is returning nil causing the script to break.
I confirmed the variable player to be equal to the player name. I have also confirmed selectedAbilities to be the correct object. Because this script only activates after a button is pressed, the likely hood that the objects aren't loaded in is about zero. I will continue to look into this and keep this post updated but any help will be appreciated
Thanks, Bees

6 comments
Is the script local or server?
The script is a normal script stored under the ServerScriptService
Have you tried :WaitForChild()?
Could you show the module
If 'player' is a Player instance, print(player) will print the player's name, but that doesn't make player a string. Overall, you're not showing us enough code to debug this. How you're getting key input from client to server is of course important.
Thank you Emily for bring this to my attention. You are correct in saying this. If you paste this comment into an Answer, I'll accept it for you.