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?
COMMUNITY QUESTION
How do I make a leaderstat multiply a leaderstat?
1 answer
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
Thanks for trying but it did not work... @natonator63
:/
one more thing- they must both be server scripts and in serverscriptservice
pardon me! i found some errors in the second script and it is now fixed. it should work now. Sorry for the inconvenience
I will check tommowrow :)
Nope, it did not work :/
bruh. YOU MAKE TWO SEPERATE SCRIPTS. INSERT THEM IN SERVERSCRIPTSERVICE. AND PUT THESE SCRIPTS IN THERE.