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: Help? DataStore issue

Previous Thread :: Next Thread 
Games272 is not online. Games272
Joined: 22 Dec 2013
Total Posts: 18
27 Jul 2016 02:42 PM
--The issue is that it prints even though I never SetAsync for the gear in the DataStore. I only want to print what is actually what the player has.

local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"}
local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")

for i = 1, #x do
if ds:GetAsync(player.userId, x[i]) then
local v = Instance.new("Model")
v.Name = tostring(x[i])
v.Parent = p
print(x[i] .. " was added to " .. player.Name .. "'s inventory.")
end
end
Report Abuse
Games272 is not online. Games272
Joined: 22 Dec 2013
Total Posts: 18
27 Jul 2016 02:44 PM
bump
Report Abuse
Games272 is not online. Games272
Joined: 22 Dec 2013
Total Posts: 18
27 Jul 2016 02:49 PM
plz
Report Abuse
Games272 is not online. Games272
Joined: 22 Dec 2013
Total Posts: 18
27 Jul 2016 03:07 PM
2
Report Abuse
Games272 is not online. Games272
Joined: 22 Dec 2013
Total Posts: 18
27 Jul 2016 11:46 PM
help
Report Abuse
oscree is not online. oscree
Joined: 19 Dec 2008
Total Posts: 127
27 Jul 2016 11:58 PM
local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"}
local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")

for i = 1, #x do
if ds:GetAsync(player.userId, x[i]) then
local v = Instance.new("Model")
v.Name = tostring(x[i])
v.Parent = p
print(x[i] .. " was added to " .. player.Name .. "'s inventory.")
end
end
Report Abuse
HeavenLogin is not online. HeavenLogin
Joined: 26 Jun 2014
Total Posts: 265
28 Jul 2016 12:08 AM
that's the same code
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
28 Jul 2016 12:09 AM
no it's not, stop judging his commenting habits

Formerly ToxicDominator - add 17,509 posts
Report Abuse
oscree is not online. oscree
Joined: 19 Dec 2008
Total Posts: 127
28 Jul 2016 12:10 AM
I don't think you even had time to try it.
Report Abuse
HeavenLogin is not online. HeavenLogin
Joined: 26 Jun 2014
Total Posts: 265
28 Jul 2016 12:13 AM
lol, if u don't know how to script then leave.
Report Abuse
oscree is not online. oscree
Joined: 19 Dec 2008
Total Posts: 127
28 Jul 2016 12:14 AM
You came on here and criticized my solution without even seeing if it worked. You are the one who cannot script.
Report Abuse
HeavenLogin is not online. HeavenLogin
Joined: 26 Jun 2014
Total Posts: 265
28 Jul 2016 12:17 AM
cringy troll

his code:
local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"}
local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")

for i = 1, #x do
if ds:GetAsync(player.userId, x[i]) then
local v = Instance.new("Model")
v.Name = tostring(x[i])
v.Parent = p
print(x[i] .. " was added to " .. player.Name .. "'s inventory.")
end
end

your code:
local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"}
local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")

for i = 1, #x do
if ds:GetAsync(player.userId, x[i]) then
local v = Instance.new("Model")
v.Name = tostring(x[i])
v.Parent = p
print(x[i] .. " was added to " .. player.Name .. "'s inventory.")
end
end
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
28 Jul 2016 12:18 AM
local InventoryData = {}

local data = {}


data.LoadData = function(player)
local UserId = player.UserId
local Data = PlayerData:GetAsync(UserId)

if Data then InventoryData = Data else PlayerData:SetAsync(UserId,InventoryData) end

for i,v in next, InventoryData do
GetDataValues(v)
end
end

GetDataValues = function(val)
local Inventory = player:WaitForChild('Inventory')
local Tool = Instance.new('Model',Inventory)
Tool.Name = val
print(tool.Name..' added to inventory')
end

SetDataValues = function(val)
if v:IsA('Tool') then
table.insert(InventoryData,v.Name)
end
end

data.SaveData = function(player)
local UserId = player.UserId
local Inventory = player:WaitForChild('Inventory')

for i,v in next, Inventory:GetChildren() do
SetDataValues(v)
end

PlayerData:SetAsync(UserId,StatsData)
end

return data


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
28 Jul 2016 12:18 AM
PlayerData:SetAsync(UserId,InventoryData) *


Report Abuse
oscree is not online. oscree
Joined: 19 Dec 2008
Total Posts: 127
28 Jul 2016 12:20 AM
Did you just steal my script?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
28 Jul 2016 12:40 AM
No. This is my datastore handler that I modified to work with his code.


Report Abuse
oscree is not online. oscree
Joined: 19 Dec 2008
Total Posts: 127
28 Jul 2016 09:10 AM
Not you.
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