|
| 28 Jun 2014 12:14 AM |
Ok, so everything works except the player removing event. The event works I'm pretty sure, but it's not changing the value. It's supposed to set my value to 1337 and then when I rejoin my value will be 1337 but instead when it loads it's 0. Why is this?
--[[Basically skip down until the player removing event, I just figured I should post the whole script.--]]
local statsDataStore = game:service("DataStoreService"):GetDataStore("StatsData")
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(character) p:WaitForChild("PlayerGui") p.PlayerGui:WaitForChild("stats") if statsDataStore ~= nil then local stats = statsDataStore:GetAsync(p.userId) p.PlayerGui.stats.Value.Value = stats end end) end)
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(character) character.Humanoid.Died:connect(function(saver) p:WaitForChild("PlayerGui") p.PlayerGui:WaitForChild("stats") if statsDataStore ~= nil then statsDataStore:SetAsync(p.userId, p.PlayerGui.stats.Value.Value) end end) end) end)
game.Players.PlayerRemoving:connect(function(byeP) p:WaitForChild("PlayerGui") p.PlayerGui:WaitForChild("stats") p.PlayerGui.stats.Value.Value = 1337 if statsDataStore ~= nil then
statsDataStore:SetAsync(byeP.userId, byeP.PlayerGui.stats.Value.Value) end end) |
|
|
| Report Abuse |
|
|
| 28 Jun 2014 12:25 AM |
| in the function you have (byeP) but in the code you try to access 'p' instead |
|
|
| Report Abuse |
|
| |