So, I watched some roblox tutorials (wich is this one: https://education.roblox.com/en-us/resources/adventure-game-intro-and-setup ). But... Wait... How i will save what players obtained (in this case, 3 IntValues in a Leaderstats Script). I don't know ANYTHING about DataStore, and i only know really basic things (sorry). So, i need to make a DataStore for 3 IntValues (wich are witen in the script)

  • Is Necesary put the DataStore In the same Leaderstats Script?

  • Is necesary to modify the ENTIRE script?

Here is the Leaderstats Script:

 -- Creates a leaderboard that shows player variables
    local function onPlayerJoin(player)
    	local leaderstats = Instance.new("Folder")
    	leaderstats.Name = "leaderstats"
    	leaderstats.Parent = player
     
    	local gold = Instance.new("IntValue")
    	gold.Name = "Gold"
    	gold.Value = 3100
    	gold.Parent = leaderstats
     
    	local items= Instance.new("IntValue")
    	items.Name = "Molecules"
    	items.Value = 0
    	items.Parent = leaderstats
     
    	local spaces = Instance.new("IntValue")
    	spaces.Name = "Spaces"
    	spaces.Value = 2
    	spaces.Parent = leaderstats
     
    end
     
    -- Run onPlayerJoin when the PlayerAdded event fires
    game.Players.PlayerAdded:Connect(onPlayerJoin)

PS: Lots of my questions are not being answered, so if you have a possible answer say it!

2 comments

0

I would recommend AlvinBlox's video on DataStores, iv'e used the method he uses in that video and it works well, and it should hopefully help you with this. https://www.youtube.com/watch?v=DkYupSBUpes

0

Yes, i know... but how do i make a data store for 3 IntValues on the same script (if it is necessary)