I just started to learning Profile Service and I don’t know how to make stats adding overtime with Profile Service. I tried this script below but it doesnt work at all. Can someone help me please?
local amount = 150
local amount2 = 200
local giveTime = 15
--//Services
local Replicated = game:GetService('ReplicatedStorage')
local Players = game:GetService("Players")
--//Required modules
local PlayerDataManager = require(game:GetService("ServerScriptService").PlayerDataManager)
while task.wait(giveTime) do
for _,plr in pairs(Players:GetChildren()) do
local stats = plr:FindFirstChild('leaderstats')
local SoulStats = PlayerDataManager:GetPlayerProfile(plr)
PlayerDataManager:GetPlayerProfile(plr):andThen(function(Profile)
local stats = Profile.Data.Souls
if stats < 175000 then
stats += amount
elseif stats.Souls.Value >= 175000 then
stats += amount2
end
end)
end
end