landon90
|
  |
| Joined: 26 Dec 2008 |
| Total Posts: 1847 |
|
|
| 17 May 2015 05:04 PM |
This is supposed to save both Wins and Cash, but when you join back makes both values equal to the cash value. CashStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
function PlayerEntered(player) repeat wait() until player.Character local stats = Instance.new("IntValue") stats.Parent = player stats.Name = "leaderstats" local cash = Instance.new("IntValue") cash.Parent = stats cash.Name = "Wins" local cassh = Instance.new("IntValue") cassh.Parent = stats cassh.Name = "Cash"
if CashStore:GetAsync("Points_"..player.Name) ~= nil then cash.Value = CashStore:GetAsync("Points_"..player.Name) else cash.Value = 0 end cash.Changed:connect(function(Val) CashStore:SetAsync("Points_"..player.Name, Val) end) if CashStore:GetAsync("Points_"..player.Name) ~= nil then cassh.Value = CashStore:GetAsync("Points_"..player.Name) else cassh.Value = 0 end cassh.Changed:connect(function(Val) CashStore:SetAsync("Points_"..player.Name, Val) end) end
game.Players.PlayerAdded:connect(PlayerEntered) |
|
|
| Report Abuse |
|