I want the leaderstat Cash to be auto given every 2 minutes. I want 10 Cash to be auto given. But if the player has Multi then the Multi multiplies the Cash given by the amount of the players Multi. Can anyone help me?
What I would do is insert a separate value in the player that indicates how much the multiplier is.
game.Players.PlayerAdded:Connect(function(plr) local multi = Instance.new("IntValue",plr) multi.Name = "Multiplier" local leaderstats = Instance.new("Folder",plr) leaderstats.Name = "leaderstats" local Cash = Instance.new("IntValue",leaderstats) Cash.Name = "Cash" multi.Value = 2 -- lets say the multiplier is * 2 end)
the script above simply inserts the values needed into the player.
--seperate script game.Players.PlayerAdded:Connect(function(plr) while true do plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + plr.Multiplier.Value * 10 --really just 2*10 wait(120) end end)
not checked, please reply if you see any errors. thank you!