Error when I use :Set() (DataStore2)

Trying to save a variable known as new_name to a datastore but I get an error

20:14:45.305 - ServerScriptService.save_script:144: attempt to index nil with ‘Set’

Here is line 144 (not giving out full script because I don’t want anyone stealing scripts)

bunkernameStore:Set(new_name)

I printed new_name and it had a value I think but i cant remember.

This error is telling you that bunkernameStore is nil and isn’t a valid variable. Make sure you’ve clearly defined bunkernameStore within the scope earlier in the script and that you’ve spelled it correctly (CASE SENSITIVE).

1 Like

It says that bunkernamestore is only used in the enclosing function and suggests i change it to local. I’m not sure why it doesnt recognize the variable, i copied and pasted the variable to make sure it wasnt a typo.

Are you able to share your script here so we can help further assist you?

2 Likes

i can dm it
30 charsssssssssss

How do we help you then??

Show us how you’ve defined your variables so we can at least assume some context.

1 Like