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

Help with Datastores?

local zauna = game:GetService("DataStoreService"):GetDataStore("Zauna")

script.Parent.MouseButton1Click:connect(function(player)
	local leaderstats = player.leaderstats
	local zaunapoints = player.leaderstats.Zauna
	
	local key = "user_" .. player.userId
	wait(0.1)
	zauna:UpdateAsync(key, zaunapoints.Value)
end)

I'm really new to Datastores, and I'm really confused with them. I can't really see what I'm doing wrong. I don't know, but maybe the "player" variable doesn't really access the player? Or maybe a capitalization error? I can't really find anything. I really don't know much about datastores. I'm just experimenting because I'm trying to get a working saving script in my game.

4 comments

0

What are you trying to do here?

0

nevermind, i got it working. it was probably glitched or something.

0

Also, I was trying to make a save button.

0

Oh, ok then.

1 answer

Yeah it seems you figured it out. Just remember that MouseButton1Down doesn't give the player. You would use a local script to get the player for GUIs. The use remote events to communicate with the server and save. Good luck!

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