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 |
|
|
|
| 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 |
|
|
|
| 14 Mar 2014 03:40 PM |
| Oops,forgot an extra parent there XD |
|
|
| Report Abuse |
|
|
KodakKid3
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 2860 |
|
|
| 14 Mar 2014 03:41 PM |
| How would I save it though? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|