I've tried getting the arguments right in the methods :GetAsync() and :SetAsync() but nothing new happens like it doesn't save. I don't know if my arguments are wrong or what, no error occurs either. Any help?
-----Saving game.Players.PlayerRemoving:connect(function(plr) local Data=game:GetService("DataStoreService") local button=workspace.PartTwo:FindFirstChild("SurfaceGui").Frame:WaitForChild("Button") -----Name Data:GetDataStore("SaveApplication") -----Save while wait(3) do Data:SetAsync("Keysave",button) end end) ------Loading game.Players.PlayerAdded:connect(function(plr) local Data=game:GetService("DataStoreService") local button=workspace.PartTwo:FindFirstChild("SurfaceGui").Frame:WaitForChild("Button") -----Name Data:GetDataStore("SaveApplication") -----Save Data:GetAsync("Keysave",button) end)
You cannot save instances directly to ROBLOX DataStores. However, you can save the parameters of the TextButton.
For example, the position and text. An example of saving text, is
Data:SetAsync("Keysave", button.Text)
When a player joins another server, you can have the script create the TextButton and apply the DataStore's values.