Ok. So, I understand this as a very basic idea of assigning a variable, but I want to be able to have the ability to update and save. I've read up on the DataStoreService and I am just confused on how I do this in reality for my script. I just want to be able to store a numerical value.
So far, I have basically this. I need help assigning the value to the actual player. Im not sure how to effectively assign the number to the particular player when they touch the block.
local game = game:GetService("DataStoreService"):GetDataStore("StageNumber") local key = "user_" .. player.userId function PlayerAdded () game.Players.PlayerAdded:connect(function(player) player = workspace:FindFirstChild("Player") if (game:GetAsync(key) >= 1) then print ("Welcome Back " .. player.GetFullName()) else game:SetAsync(key, 1) print ("Welcome " .. player.GetFullName()) end end) end for _, player in pairs(game.Players:GetPlayers()) do PlayerAdded(player) -- Use your player added handling function here. end if (game.Players:FindFirstChild("Player1") == true) then game:GetService("DataStoreService"):GetDataStore("StageNumber"):SetAsync("Player1", 1) end
Please help me understand this.
Thanks for your time, -rider