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 » Scripters
Home Search
 

Re: DataStore table not working, no output.

Previous Thread :: Next Thread 
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
22 Dec 2014 11:02 PM
I get no output using this code, what am I doing wrong?


local ds = game:GetService("DataStoreService"):GetDataStore("CardsSave0.1")
PlayersCards = ds:GetAsync("Cards0.1")

game.Players.PlayerAdded:connect(function(Plr)
if ds:GetAsync(Plr.userId,PlayersCards) == nil then
print ("no cards to load")
else
for i, v in pairs(PlayersCards) do
local val = game.Lighting.Cards[v.Name]:clone()
val.Parent = game.Players[Plr.Name].Cards
end
end
end)

game.Players.PlayerRemoving:connect(function(Plr)
for i, v in pairs(Plr.Cards:GetChildren()) do
table.insert(PlayersCards,v.Name)
end
if ds:GetAsync(Plr.userId,PlayersCards) == nil then
ds:SetAsync(Plr.userId,PlayersCards)
else
ds:UpdateAsync(Plr.userId,function()
return PlayersCards
end)
end
end)
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
22 Dec 2014 11:04 PM
wait what are you doing
what is point of the table you dont even use it ever
Report Abuse
ruon123 is not online. ruon123
Joined: 22 Jan 2011
Total Posts: 325
22 Dec 2014 11:13 PM
@KLGA
i dont think you understand the point of DataStores
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
22 Dec 2014 11:25 PM
Bump Please -_-
I can never get any help when I ask about DataStore I honestly need this tonight...
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
22 Dec 2014 11:30 PM
Make sure everything is actually running by adding print statements everywhere. Then tell us where it stops, if it stops,
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
22 Dec 2014 11:40 PM
I had an issue with the adding player it was something like line 5 something was nil and fixed that, I think it has something to do with the removing of player seeing as I get no output.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
22 Dec 2014 11:47 PM
I get this from the prints below.
Started
Player Added to Game
No cards founds
Player has entered
The End!

PlayerAdded seems to work.
It's when the player leaves...

local ds = game:GetService("DataStoreService"):GetDataStore("CardsSave0.1")
PlayersCards = ds:GetAsync("Cards0.1")
print("Started")
game.Players.PlayerAdded:connect(function(Plr)
print("Player Added to Game")
if ds:GetAsync(Plr.userId,PlayersCards) == nil then
print ("No cards found")
else
for i, v in pairs(PlayersCards) do
print("Cards found")
local val = game.Lighting.Cards[v.Name]:clone()
val.Parent = game.Players[Plr.Name].Cards
end
end
end)
print("Player has entered")
game.Players.PlayerRemoving:connect(function(Plr)
for i, v in pairs(Plr.Cards:GetChildren()) do
table.insert(PlayersCards,v.Name)
end
if ds:GetAsync(Plr.userId,PlayersCards) == nil then
ds:SetAsync(Plr.userId,PlayersCards)
else
ds:UpdateAsync(Plr.userId,function()
return PlayersCards
end)
end
end)
print("The End!")
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
22 Dec 2014 11:49 PM
Replace the PlayerRemoving with ChildRemoved then.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
22 Dec 2014 11:56 PM
Still the same.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 12:17 AM
Someone has to know :(
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 12:28 AM
:(
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 12:55 AM
Guys rly
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 01:25 AM
bump
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 02:56 AM
real
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 03:45 AM
plssssssssssssss
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
23 Dec 2014 04:42 AM
if ds:GetAsync(Plr.userId,PlayersCards) == nil then
print ("no cards to load")
else
for i, v in pairs(PlayersCards) do

Mm no.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 11:05 AM
Ok it's not like I'm asking for someone to make a whole new script for me, just correct my errors please -_-

Besides with leaderboards this is the first time I've used DataStore and got this far... Just asking for some help.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 11:19 AM
-_-
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 12:20 PM
?


-Codys4x4 - Send me a trade.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 01:10 PM
ogm


-Codys4x4 (C4) - Send me a trade.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 02:42 PM
kk


-Codys4x4 (C4) - Send me a trade.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 03:17 PM
bump
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 04:46 PM
bump
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 04:55 PM
bump
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 05:01 PM
bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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