So i made bools named Trophy1...10 for each of the trophies on the map.They work so that once you click a trophy it sets the bool inside your player to true so that you can't click it again as in you've alrdy found this trophy. The trouble is saving this info to Data store.

As you can see i've tried preforming a check to see if the value is true and then if it is it should be saved upon player leaving but that's not the case.

Thanks for your time

local data = game:GetService("DataStoreService")
local dataStor = data:GetDataStore("MobbyProgress")


key = 'MobbyProgress_'..p.userId
	
	local saveData = dataStor:GetAsync(key)
	
	if saveData then 	
		stage.Value = saveData[1]
		Trophies.Value = saveData[2]
		if Trophy1.Value == true then 
			Trophy1.Value = saveData[3]
			 end
	else 
		dataStor:SetAsync(key, {1,0}) 

	end
end)

game.Players.PlayerRemoving:connect(function(p) 
	key = 'MobbyProgress_'..p.userId
	
	local save = {p.leaderstats.Stage.Value, p.leaderstats.Trophies.Value,p.Trophy1.Value} 

	dataStor:SetAsync(key, save)
end)

5 comments

0

I am kinda lost, you do not have any checks in the PlayerRemoving event, you simply save the data?

0

please ignore my question i've figured it out, turns out i don't even need to check if bools are true or not they get saved regardless, But thank you for taking an interest in solving my problem

0

Can you edit the title with [closed] or something so ppl know

0

Put [Solved] in the end of your title.

0

sorry about that i didn't know but i'll make sure to do that in the future