I need to save the endings or events that the player did and put a block if that player already completed that or not, something like that,but I can't think of any script to help me with that
You need to use a DataStore to do this. It's more efficient to use a bool instead of a block though.
local DataStoreService = game:GetService("DataStoreService") local EndingStore = DataStoreService:GetDataStore() --This function is only for the first time joining-- local SetEndings = function(folder) local values = { ExampleEnding = { Name = "ExampleEnding", Value = false, } } for _,ending in pairs(values) do local value = Instance.new("BoolValue",Endings) value.Name = ending.Name value.Value = ending.Value end end game.Players.PlayerAdded:Connect(function(player) local key = player.UserId .. "_Endings" --key is basically a password for the save-- local Endings = Instance.new("Folder",player) Endings.Name = "Endings" local Retrieve --Use a pcall because thats just a normal thing in data stores-- local success,errormessage = pcall(function() Retrieve = EndingStore:GetAsync(key) end) if success then if Retrieve ~= nil then --It checks if the data exists because it wont the first time you join the experience-- for _,ending in pairs(Retrieve) do local value = Instance.new("BoolValue",Endings) value.Name = ending.Name value.Value = ending.Value end else SetEndings(Endings) --Calls the function made previously-- end else warn(errormessage) end end) --now for the saving process-- game.Players.PlayerRemoving:Connect(function(player) local key = player.UserId .. "_Endings" --same key as before-- local Endings = player:WaitForChild("Endings") --the folder already exists-- local List = {} for _,ending in pairs(Endings) do local item = {} item.Name = ending.Name item.Value = ending.Value table.insert(List,item) --it creates a table of values containing the endings the player has achieved before leaving-- end local Success,errormessage = pcall(function() EndingStore:SetAsync(key,List) end) if Success then print("Successfully saved endings") else warn(errormessage) end end)
This is just an example. I haven't tested it, but its basically how to do it. If you want cubes just set a cube if the ending value is true.