Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I save what a player does in my Tycoon?

Asked by 3 years ago
Edited by Amiaa16 3 years ago

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)
0
Here is the code: kindness25 0 — 3y

1 answer

Log in to vote
2
Answered by 3 years ago
Edited 3 years ago

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!

0
If you found this answer helpful then please accept the answer and help others who're looking for same answer. Somone_exe 224 — 3y
0
Okay I'll give it a go kindness25 0 — 3y
Ad

Answer this question