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
Use Datastores as you said, no other way.
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)