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

How can I store a pin that I generated?


script.Parent.MouseButton1Click:Connect(function()
	local n1 = math.random(0, 9)
	local n2 = math.random(0, 9)
	local n3 = math.random(0, 9)
	local n4 = math.random(0, 9)
	local n5 = math.random(0, 9)
	local n6 = math.random(0, 9)
	script.Parent.Parent.Parent.SurfaceGui2.PinCode.Text = n1.. n2.. n3.. n4.. n5.. n6
end)

This is a pin generator script that I've done to start learning how to code in Lua, as you can see I started with a small working thing, but I can't figure a way out to store the pins that I generated in some sort of data store or in another surface gui. Can someone help me please? Thanks for your attention!

(As you can see in this image, I want to click that store button so my pin would get stored https://gyazo.com/cddb8326d01efefd2b56a4cb3e853c41)

2 comments

0

Use Datastores as you said, no other way.

1

Don't answer 'no other way', because you simply don't know the other ways, you can actually do this using httpservice too, and if you're really creative with things like pointservice/badges (bad idea, just an example)

1 answer

✓ Accepted answer

You want it save right? Then you can use DataStore.

Use SetAsync to save it, and GetAsync to load it.

3 comments

0

But how do I make it work with my button?

0

MouseClick event to do the function, then fire a RemoteEvent to send it to the server, and send (and load) the data to the client (and basically do the rest).

0

Why the RemoteEvent, as the wiki says, it's a server-sided item.

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