generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Saving Gears (Data Persistence or Data Store)

Previous Thread :: Next Thread 
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
14 Mar 2014 03:37 PM
The script gives you an item from Lighting if you have enough money for it, and saves it in StarterGear, so if you buy it and reset, you still have it.

I want to be able to buy an item, leave the game, then come back and still have it (So get it saved with either Data Persistence or Data Store, whichever works - I don't know much about DS).

Help?

It's a LocalScript within a TextButton.

Thanks

local Wep = "AssaultRifle" --Item Name
local Cos = 2860 --Item Price

local plr = game.Players.LocalPlayer
Mon = plr.leaderstats.Money

function onClick()
if Mon.Value >= Cos then
Mon.Value = Mon.Value - Cos
game.Lighting[Wep]:Clone().Parent = plr.Backpack
game.Lighting[Wep]:Clone().Parent = plr.StarterGear
end
end
script.Parent.MouseButton1Down:connect(onClick)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 Mar 2014 03:40 PM
I don't think data persistance can be used in a local script..
Change it to regular script,and make plr = script.Parent.Parent.Howevermanyparents

Ex:

StarterGui
-ScreenGui
--TextButton
---Script

plr = script.Parent.Parent.Parent
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 Mar 2014 03:40 PM
Oops,forgot an extra parent there XD
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
14 Mar 2014 03:41 PM
How would I save it though?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 Mar 2014 03:43 PM
Uh..that's a good question...
I guess with Data Persistance lol,I've never used it,I just know it can't be run via localscript
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
14 Mar 2014 03:54 PM
Data Store can't save a gear, which is an tool, which is an instance. You can use Data Persistence or you can try a possible solution on the Data Store wiki page, under Limitations.

When life gives you lemons... BURN HIS HOUSE DOWN! >:D
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 Mar 2014 03:56 PM
You could save the name of the tool as a string,and then clone the tool from lighting with the string name XD
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
14 Mar 2014 04:01 PM
So how could I do this with Data Persistence?

Specifically please, I really haven't used it that much at all.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 Mar 2014 04:15 PM
Tbh,you should do some research on wiki..
Ik like almost nothing about DP and DS
Never used it,not even once
Report Abuse
Kingmouli is not online. Kingmouli
Joined: 28 Sep 2012
Total Posts: 1292
14 Mar 2014 04:21 PM
Never used it but it should be like

player:WaitForDataReady()
player:SaveInstance("Super Guuuun", path.to.the.gun.or.variable.representing.the.gun)

Then to load:
player:WaitForDataReady()
gun = player:LoadInstance("Super Guuuun")
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
14 Mar 2014 06:20 PM
Yeah, couldn't get it to work.

Can anyone just apply it directly to the script so I can see what it would look like, exactly, and figure it out?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image