can someone help me i Trying to create a Stats script no errors only problem is t wont save somehow
Script:
local DataStoreService = game:GetService("DataStoreService"):GetDataStore("saveData")
game.Players.PlayerAdded:Connect(function(player)
wait(0.1)
local player_Key = "Test3"..player.UserId
--Currency
local yinV = player.yin
--stats
local FistStrengthV = player.FistStrength
local BodyToughnesV = player.BodyToughnes
local MovementSpeedV = player.MovementSpeed
local JumpForceV = player.JumpForce
local PsychicPowerV = player.PsychicPower
--Multiplayers
local FSMultiV = player.FSMulti
local BTMultiV = player.BTMulti
local MSMultiV = player.MSMulti
local JFMultiV = player.JFMulti
local PPMultiV = player.PPMulti
local getSaved = DataStoreService:GetAsync(player_Key)
if getSaved then
FistStrengthV.Value = getSaved[1]
yinV.Value = getSaved[2]
BodyToughnesV.Value = getSaved[3]
MovementSpeedV.Value = getSaved[4]
JumpForceV.Value = getSaved[5]
PsychicPowerV.Value = getSaved[6]
else
local Values = {FistStrengthV.Value, FistStrengthV.Value, yinV.Value, BodyToughnesV.Value, MovementSpeedV.Value, JumpForceV.Value, PsychicPowerV.Value, FSMultiV.Value, BTMultiV.Value,MSMultiV.Value, JFMultiV.Value, PPMultiV.Value}
DataStoreService:GetAsync(player_Key, Values)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
DataStoreService:GetAsync("Test3"..player.UserId,{player.FistStrength.Value, player.yin.Value, player.BodyToughnes.Value, player.MovementSpeed.Value, player.JumpForce.Value, player.PsychicPower.Value, player.FSMulti.Value, player.BTMulti.Value, player.MSMulti.Value, player.JFMulti.Value, player.PPMulti.Value})
end)