|
| 16 Nov 2014 08:30 AM |
---Yes this is long, no errors in output, only problem is that "Goldbars" Only saves very rarely, and its a bit of an issue its anoying any help would be loved, coins and such save but not gold. :( Its not local and its in severscriptservice local DataStoreService = game:GetService("DataStoreService") game.Players.PlayerAdded:connect( function(Player) local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData") ----- print(Player.Name .. ", You've joined " .. PlayerStore:GetAsync("Joins") .. " Times!") if PlayerStore:GetAsync("Joins") >= 10 then print"You've visted more then 10 times ;D THANKS!" end print((PlayerStore:GetAsync("Coins") or "0") .. " Coins in your bank") print((PlayerStore:GetAsync("GoldBars") or "0") .. " GoldBars in your bank") ----Start Of Client Store local DataStore = Instance.new("IntValue") DataStore.Name = "Data" DataStore.Parent = Player ------Player load local coins = Instance.new("NumberValue") coins.Name = "Coins" coins.Parent = DataStore coins.Value = PlayerStore:GetAsync("Coins") ----- local gold = Instance.new("NumberValue") gold.Name = "GoldBars" gold.Parent = DataStore gold.Value = PlayerStore:GetAsync("GoldBars") ----- local joined = Instance.new("NumberValue") joined.Name = "Joins" joined.Parent = DataStore joined.Value = PlayerStore:GetAsync("Joins") ----- Player:WaitForChild("Data") joined.Value = joined.Value +1 if Player.Data.Joins.Value <2 then ---- print"I see this is your first time playing :D Thanks for playing" else print"You've played before, THANKS! :D" end ------ print("You have " .. (PlayerStore:GetAsync("Coins") or "0") .. " Coins!") print("You have " .. (PlayerStore:GetAsync("GoldBars") or "0") .. " GoldBars!") print("You've joined " .. PlayerStore:GetAsync("Joins") .. " Times!") end ) -----UpdateAsync game.Players.PlayerRemoving:connect(function(Player) local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData") PlayerStore:SetAsync("Coins", Player.Data.Coins.Value) PlayerStore:SetAsync("Joins", Player.Data.Joins.Value) PlayerStore:SetAsync("GoldBars", Player.Data.GoldBars.Value) end) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 16 Nov 2014 08:31 AM |
game.OnClose = function() wait(10) end
You're welcome. |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 08:33 AM |
| Not to sound like a fool, but were would I put that? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 16 Nov 2014 08:34 AM |
Anywhere. Just make it outside of a function, if you could... |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 08:35 AM |
So don't use this , game.Players.PlayerRemoving:connect(function(Player)? |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 08:38 AM |
I did, but still wait() local DataStoreService = game:GetService("DataStoreService") game.Players.PlayerAdded:connect( function(Player) local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData") ----- print(Player.Name .. ", You've joined " .. PlayerStore:GetAsync("Joins") .. " Times!") if PlayerStore:GetAsync("Joins") >= 10 then print"You've visted more then 10 times ;D THANKS!" end print((PlayerStore:GetAsync("Coins") or "0") .. " Coins in your bank") print((PlayerStore:GetAsync("GoldBars") or "0") .. " GoldBars in your bank") ----Start Of Client Store local DataStore = Instance.new("IntValue") DataStore.Name = "Data" DataStore.Parent = Player ------Player load local coins = Instance.new("NumberValue") coins.Name = "Coins" coins.Parent = DataStore coins.Value = PlayerStore:GetAsync("Coins") ----- local gold = Instance.new("NumberValue") gold.Name = "GoldBars" gold.Parent = DataStore gold.Value = PlayerStore:GetAsync("GoldBars") ----- local joined = Instance.new("NumberValue") joined.Name = "Joins" joined.Parent = DataStore joined.Value = PlayerStore:GetAsync("Joins") ----- Player:WaitForChild("Data") joined.Value = joined.Value +1 if Player.Data.Joins.Value <2 then ---- print"I see this is your first time playing :D Thanks for playing" else print"You've played before, THANKS! :D" end ------ print("You have " .. (PlayerStore:GetAsync("Coins") or "0") .. " Coins!") print("You have " .. (PlayerStore:GetAsync("GoldBars") or "0") .. " GoldBars!") print("You've joined " .. PlayerStore:GetAsync("Joins") .. " Times!") end ) -----UpdateAsync game.OnClose = function() game.Players.PlayerRemoving:connect(function(Player) local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData") PlayerStore:SetAsync("Coins", Player.Data.Coins.Value) PlayerStore:SetAsync("Joins", Player.Data.Joins.Value) PlayerStore:SetAsync("GoldBars", Player.Data.GoldBars.Value) end) wait(10) end |
|
|
| Report Abuse |
|
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 16 Nov 2014 08:45 AM |
game.OnClose = function() game.Players.PlayerRemoving:connect(function(Player) local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData") PlayerStore:SetAsync("Coins", Player.Data.Coins.Value) PlayerStore:SetAsync("Joins", Player.Data.Joins.Value) PlayerStore:SetAsync("GoldBars", Player.Data.GoldBars.Value) end) wait(10) end
WH4T 4R3 YOU DO1NG TH4T 1S NOT WH4T 1 TOLD YOU TO DO 4T 4LL
game.Players.PlayerRemoving:connect(function(Player) local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData") PlayerStore:SetAsync("Coins", Player.Data.Coins.Value) PlayerStore:SetAsync("Joins", Player.Data.Joins.Value) PlayerStore:SetAsync("GoldBars", Player.Data.GoldBars.Value) end) game.OnClose = function() wait(10) end
L1K3 TH4T YOU FOOL |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 08:49 AM |
| :( I'm sorry, but thanks, you seam to be the only person that helps me here. Thanks |
|
|
| Report Abuse |
|
|