I have attempted to make a Save Button for the stats on my game, however it doesn't seem to work. This is the code:
local plr = game.Players.LocalPlayer
plr:WaitForDataReady()
local StatData = plr:WaitForChild('StatData')
local Strength = StatData:WaitForChild('Strength')
local Agility = StatData:WaitForChild('Agility')
local Ki = StatData:WaitForChild('Ki')
function onClick()
plr:SaveNumber("Strength",plr.StatData.Strength.Value)
plr:SaveNumber("Agility",plr.StatData.Agility.Value)
plr:SaveNumber("Ki",plr.StatData.Ki.Value)
print("Saved")
end
script.Parent.MouseButton1Click:connect(onClick)
No error comes out, it just doesn't seem to work. I tried putting a print in there to see if it works to the end, but it doesn't do the print. Still no error in the Output though :/. Could someone please help? Thanks in advance.

2 comments
SaveNumber and WaitForDataReady are both deprecated. It's best to use DataStore now. http://wiki.roblox.com/index.php?title=Data_store
This doesn't answer my question. When people lose connection or when I shut down the game to update, people tend to lose their data. That is the reason I added a Save Button, as the Data Store I made only saves when they join and leave the game, not when they lose connection or the game shuts down.