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
 

Re: Please I need help, look into you heart SHers

Previous Thread :: Next Thread 
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
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 is not online. 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
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
16 Nov 2014 08:33 AM
Not to sound like a fool, but were would I put that?
Report Abuse
eLunate is not online. 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
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
16 Nov 2014 08:35 AM
So don't use this ,
game.Players.PlayerRemoving:connect(function(Player)?
Report Abuse
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
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
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
16 Nov 2014 08:39 AM
Cri
Report Abuse
eLunate is not online. 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
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
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
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