Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[ CASE CLOSED? ]

I have this datastore script but its not saving my data and I was wondering if its because im in studio?

local datastoreservice = game:GetService("DataStoreService")
local datastore = datastoreservice:GetDataStore("mydatastore")
game.Players.PlayerAdded:Connect(function(player)
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local Green = Instance.new("IntValue")
	Green.Name = "Green"
	Green.Parent = leaderstats
	Green.Value = datastore:GetAsync(player.UserId.."Green")
	
end)

game.Players.PlayerRemoving:Connect(function(player)
	
	datastore:SetAsync(player.UserId.."Green", player.leaderstats.Green.Value)
	
end)

3 comments

0

try it in a game

0

Ok

0

I think it worked XD

1 answer

Go to Studio>Settings>Security>Enable Studio Access to API services>On What that does is it lets you test datastores in studio. Also, I recommend making an answer if someone or yourself answers you question, and so if you accept it, both of you will get some reputation.

This discussion is preserved as it was. New answers, comments, and votes are closed.