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
 

Why isn't this DataStore script not working?

Previous Thread :: Next Thread 
DispenseTheDispenser is not online. DispenseTheDispenser
Joined: 20 Jun 2013
Total Posts: 2268
05 Dec 2014 06:29 PM
Sorry if I got this completely wrong - very new to DataStores, been using Data Persistence for a while.

local service = game:GetService("DataStoreService")
local val = game:GetService("DataStoreService"):GetDataStore("points")

game.Players.PlayerAdded:connect(function(player)
local stats = Instance.new("Model", player)
stats.Name = "leaderstats"
local points = Instance.new("IntValue", stats)
points.Name = "sup"
points.Value = val:GetAsync("hello")
end)

game.Players.PlayerRemoving:connect(function(player)
local newpoints = player.leaderstats.sup
val:SetAsync("hello", newpoints.Value)
end)
Report Abuse
FutureWebsiteOwner is online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
05 Dec 2014 06:31 PM
you would have to join, leave and join again to find value...
also on player remove, i would ask if leaderstats ~= nil but that's me
Report Abuse
lateregistration is not online. lateregistration
Joined: 02 Apr 2013
Total Posts: 2630
05 Dec 2014 06:33 PM
Are you asking us why it doesn't work, or why it doesn't NOT work?
Report Abuse
FutureWebsiteOwner is online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
05 Dec 2014 06:34 PM
^


;P
Report Abuse
DispenseTheDispenser is not online. DispenseTheDispenser
Joined: 20 Jun 2013
Total Posts: 2268
05 Dec 2014 06:34 PM
How could I have not known xD

Thanks.
Report Abuse
TeddyBauer is not online. TeddyBauer
Joined: 24 Jul 2014
Total Posts: 224
06 Dec 2014 02:53 AM
very confuse.
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