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
|
  |
| Joined: 27 Jan 2011 |
| Total Posts: 630 |
|
|
| 01 Apr 2015 08:00 AM |
| Can you tell us the errors you got? |
|
|
| Report Abuse |
|