So basically what happens is that when the player clicks on a part. The part then gets destroyed. I then use a for i loop to lerp the object to another transparent object and I am unsure how to save this. So that the player doesn't have to start the tycoon all over again.
Here is the code:
game.workspace.Box.BA:WaitForChild("B1Buy").ClickDetector.MouseClick:Connect(function(player) if (player.leaderstats.Cahs.Value - 50) >= 0 then local B1 = game.Workspace.B1 local B1Trans = game.Workspace.Box.BA.B1Transfer player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 50 game.Workspace.Box.BA.B1Buy:Destroy() SoundCraft:Play for i = 0,1,0.01 do wait() B1.CFrame = B1.CFrame:Lerp(B1Trans.CFrame,1) B1.Transparency = B1.Transparency - 0.01 end B1.CanCollide = true end end)
Use DataStore Service. I don't have a code for it but you can take a look at Roblox API documentation. https://developer.roblox.com/en-us/api-reference/class/DataStoreService*
This is the article that will help understanding dataStore more easily: https://developer.roblox.com/en-us/articles/Data-store
NOTE: DataStore does not work in the studio unless "Enable Studio Access to API Services" is enabled.
Happy Scripting!