When I try to test this Data Store script using Test Solo, the output says:
14:19:52.680 - Place has to be opened with Edit button to access DataStores 14:19:52.686 - Workspace.Script:5: attempt to index local 'PlayerStore' (a nil value) 14:19:52.688 - Script 'Workspace.Script', Line 5 14:19:52.688 - stack end
Why is it returning nil? Also I am in edit mode testing it in solo, so why does it say this?
There are some prerequisites to test Data Stores:
You can check the second by running the following code in the command bar:
print(game.PlaceId)
If it is 0, you have done something wrong. How to fix? Either close the page and reload your page from the "edit" button (on the roblox site, on one of your places!) OR find out the place id of one of your places (the one you are trying to edit). For example, a place id could be (in your case):
http://www.roblox.com/Bikini-Bottom-Adventure-place?id=21215459
The PlaceId in this case is 21215459
Now, to set the place id, run the following in the place where you are testing the game in Test Server:
game:SetPlaceId(21215459)
.
Now disable every script and re-enable them. This reloads their code and now Data Stores will work.
I would shutdown Studio then reboot it. I sometimes get this. It works for me.