"attempt to index nil with "PlayerStats"

Hello,

This is a really common error but it’s different for everyone so I am asking for help

Roblox is being super dumb right now and Is acting like my “PlayerStats” BillboardGui just doesn’t exist when it clearly does

im getting the “Attempt to index nil” B.S. in the output.

Screen Shot 2023-08-29 at 4.52.59 PM

Screen Shot 2023-08-29 at 4.53.07 PM

Please help.

6 Likes

Are you accessing the stats for a server script or local script?

3 Likes

I am using a server script
//////////

2 Likes

Have you tried putting the UI in ReplicatedStorage

2 Likes

Same error, sadly. (im getting “infinite yield” because of the waitforchild)

1 Like

Are those 2 items shown in the picture the onlly items in server storage?

1 Like

Yes, they are the only items in server storage

1 Like

Check if the error is still there in runtime

1 Like

use :GetService() maybe:

local nameTag = game:GetService("ServerStorage"):WaitForChild("PlayerStats")

also, are you sure it’s a ServerScript? if yes than make sure there’s no script that removes it from the ServerStorage.

1 Like

Im guessing, the UI goes under the player on spawn, make sure the UI is cloned before parenting.

1 Like

Still the same error

this is the first line of the script, so the UI has not been cloned nor parented to the player

1 Like

go into play > run and check if the ui is still there

2 Likes

Where is the script with this line located? Could you screenshot the whole error in the output? thanks

1 Like

Can you also show pic of the actual output message

1 Like

Screen Shot 2023-08-29 at 5.18.03 PM

2 Likes

You sure there is no script moving or deleting the ui?

is archivable on

2 Likes

Archivable is off, and there is no script (that I know of) that is deleting it

1 Like

turn it on and test if its still not there

1 Like

The UI is still not there

////

1 Like

go in studio and press the following keys: Shift + Control + F. It will open a tab to research specific code in all the scripts in your game. Now try playing with the words and do for example:
ServerStorage:WaitForChild("PlayerStats"):Destroy()
ServerStorage:WaitForChild("PlayerStats"):Remove()
ServerStorage.PlayerStats:Destroy()
ServerStorage.PlayerStats:Remove()

2 Likes