Hello, I was wondering, how would I create a game similar to:
https://www.roblox.com/games/6372025206/Leave-a-Note
As in this game you leave a note, and it saves permanently in the same place.
I am looking for a youtube video or a model to help me create one of these games.
3 Likes
removed for reasons (lol limitttttttttttt)
1 Like
local data = game:GetService("DataStoreService") -- get our data service
local notes = data:GetDataStore("Notes") -- get the notes data
local server_notes = {} -- our table for server notes so that we don't overfill the data requests
game.ReplicatedStorage.EventHere.OnServerEvent:Connect(function(player, notetext)
server_notes[#server_notes+1] = notetext -- add the note in from a remote event
end)
while task.wait(60) do -- every 1 minute we update our notes
local left_notes = notes:GetAsync("GlobalNotes") -- fetching our data if we have any
if left_notes then
for _,note in pairs(server_notes) do
left_notes[#left_notes+1] = note -- we add the notes to our datastore
end
server_notes = {} -- we reset the notes so that we don't put the same note in every time
else
left_notes = server_notes -- if we dont have data we make our data the current notes in server
end
notes:SetAsync("GlobalNotes", left_notes) -- we update our data
for _,note in pairs(left_notes) do
print(note) -- we're just printing the notes to see what we have saved up.
end
end
Main key is just using a datastore like @TrentaFX suggests. Hereβs an example of what you could do, but there may be inefficiency to the way I coded this. Let me know if there are any and what they are.
5 Likes
what does this script save? parts? how to make notes that are saveable