Hello so basically, I have an obby game and It saves data and stuff, when you claim the checkpoint it has a tween that turns it green, now i wanna make it so that when you rejoin the checkpoint stays green. I tried to look this up but couldn’t find anything. I tried to use :match() but the realized it wont work. Pls help and thanks
P.S. the object name (or basically the checkpoint) is a number.
You haven’t shown much code that we can use to determine what kind of issue you’re having. That said, I have created a small demonstration on how you can save / load stages. This is only an example, but feel free to reference off of it.
local CheckPoints = workspace.CheckPoints
local Data = game:GetService("DataStoreService"):GetDataStore("Checkpoints")
local DisplayGreen = game.ReplicatedStorage.Remotes.DisplayGreen
local function loadCheckpoints(Player)
local checkPoints = Data:GetAsync(Player.UserId)
if checkPoints then
DisplayGreen:FireClient(Player, checkPoints)
end
end
local function saveCheckpoints(Player)
local savedCheckPoints = {}
for i,v in pairs(CheckPoints:GetChildren()) do
if tonumber(v.Name) <= Player.leaderstats.Stage.Value then
savedCheckPoints[v.Name]=true
end
end
Data:SetAsync(Player.UserId, savedCheckPoints)
end
game.Players.PlayerRemoving:Connect(saveCheckpoints)
for i,v in pairs(game.Players:GetPlayers()) do
task.spawn(function()
loadCheckpoints(v)
end)
end
game.Players.PlayerAdded:Connect(loadCheckpoints)