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: Data Stores help (no output)

Previous Thread :: Next Thread 
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
11 Jan 2015 08:39 PM
local DataStore = game:GetService("DataStoreService"):GetDataStore("Points")

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local l = Instance.new("IntValue", leaderstats)
l.Name = "Level"
local key = player.leaderstats.Level
--we want to give 50 points to users each time they visit
DataStore:UpdateAsync(key, function(Level)
local newLevel = Level or 0 --oldValue might be nil
game.Workspace.LevelTPer.Touched:connect(function()
newLevel = newLevel + 1
return newLevel
end)
end)
end)

Please take this model - http://web.roblox.com/Dead-dogicorn-item?id=202541510
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
11 Jan 2015 08:46 PM
print "bump 1"

Please take this model - http://web.roblox.com/Dead-dogicorn-item?id=202541510
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
11 Jan 2015 10:53 PM
b2

Please take this model - http://web.roblox.com/Dead-dogicorn-item?id=202541510
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
11 Jan 2015 11:02 PM
Your code makes no sense lol

But I think you're going for something liek this?

local ds = game:GetService("DataStoreService"):GetDataStore("Points")

game.Players.PlayerAdded:connect(function(plr)
local leaderstats = Instance.new("Model", plr)
leaderstats.Name = "leaderstats"
local l = Instance.new("IntValue", leaderstats)
l.Name = "Level"
local key = tostring(plr.userId).."_money"
if ds:GetAsync(key) ~= nil then
ds:UpdateAsync(key, function(last)
return last + 50;
end)
else
ds:SetAsync(key,50)
end
end)
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
11 Jan 2015 11:03 PM
Yeah yeah that

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
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