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