Hello, Today i was making really cool script but it isnt working What is the problem? i think i am true but..
Script:
local Players = game:GetService("Players")
local DT = game:GetService("DataStoreService")
local DS = DT:GetDataStore("CashSaveSystem")
Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Configuration", plr)
leaderstats.Name = "leaderstats"
local Speed = Instance.new("IntValue", leaderstats)
Speed.Name = "Speed"
Speed.Value = DS:GetAsync(plr.UserId) or 0
local JumpPower = Instance.new("IntValue", leaderstats)
JumpPower.Name = "JumpPower"
JumpPower.Value = DS:GetAsync(plr.UserId) or 0
plr.CharacterAdded:Connect(function(chr)
local Humanoid = chr:WaitForChild("Humanoid")
Humanoid.WalkSpeed = Speed.Value
Humanoid.JumpPower = JumpPower.Value
Humanoid.StateChanged:Connect(function(state)
if Enum.HumanoidStateType.Running == state then
Speed.Value = Speed.Value +1
elseif Enum.HumanoidStateType.Jumping == state then
JumpPower.Value = JumpPower.Value +1
end
end)
end)
end)
Players.PlayerRemoving:Connect(function(plr)
local Speed = plr.leaderstats.Speed
local JumpPower = plr.leaderstats.JumpPower
DS:SetAsync(plr.UserId, Speed.Value, JumpPower.Value)
end)

2 comments
try changing int values to number values
StateChanged passes two parameters the old and new state. You alos only updaye the JumpPower and WalkSpeed when the player spawns.