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
 

DataStores

Previous Thread :: Next Thread 
devMe is not online. devMe
Joined: 28 Jun 2014
Total Posts: 155
01 Apr 2015 07:56 AM
I've just started using DataStores, and made this script. Can anyone tell me why it doesnt work?

game.Players.PlayerAdded:connect(function(plr)
local stats = script.Stats:Clone()
stats.Parent = plr

local ds = game:GetService("DataStoreService")
local stats = ds:GetDataStore("Stats")
if stats:GetAsync("Rank") == nil then
stats:SetAsync("Rank", 1)
end
if stats:GetAsync("Exp") == nil then
stats:SetAsync("Exp", 0)
end
if stats:GetAsync("MaxExp") == nil then
stats:SetAsync("MaxExp", 100)
end

plr.Stats.Rank.Changed:connect(function()
stats:IncrementAsync("Rank", 1)
plr.PlayerGui.GUIs.TopBar.SecondaryBar.Level.Text = "Rank "..plr.Stats.Rank.Value..""
end)
plr.Stats.Exp.Changed:connect(function()
stats:UpdateAsync("Exp", plr.Stats.Exp.Value)
plr.PlayerGui.GUIs.TopBar.SecondaryBar.Cover.Size = UDim2.new(plr.Stats.Exp.Value/plr.Stats.MaxExp.Value, 0, 1, 0)
end)
plr.Stats.MaxExp.Changed:connect(function()
stats:UpdateAsync("MaxExp", plr.Stats.MaxExp.Value)
end)
end)
Report Abuse
Vexture is not online. Vexture
Joined: 27 Jan 2011
Total Posts: 630
01 Apr 2015 08:00 AM
Can you tell us the errors you got?
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