Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

1 comment

0

Here is the code:

1 answer

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!

2 comments

0

If you found this answer helpful then please accept the answer and help others who're looking for same answer.

0

Okay I'll give it a go

This discussion is preserved as it was. New answers, comments, and votes are closed.