Why if not data.Items[Name] then throws error?

Hello. Today, 1 guy joined my game, and reported me error with data.
When I looked in problem, I found error:

if not data.Items[Name] then

ServerScriptService.ServerPlacementAndData:480: attempt to index nil with 'AlluminiumIngot'
Previously, this error don’t exist, bc as I mean, if data.Items.AlluminiumIngot not exist, in will return true instead of error. Can someone tell me, what I’m making wrong here?

1 Like

The error is caused by the fact that either data or data.Items is nil. Don’t know the rest of the script, but you can try adding prints once in a while to make sure the data is correct.

2 Likes