Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a leaderstat multiply a leaderstat?

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?

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!

7 comments

0

Thanks for trying but it did not work... @natonator63

0

:/

0

one more thing- they must both be server scripts and in serverscriptservice

0

pardon me! i found some errors in the second script and it is now fixed. it should work now. Sorry for the inconvenience

0

I will check tommowrow :)

0

Nope, it did not work :/

0

bruh. YOU MAKE TWO SEPERATE SCRIPTS. INSERT THEM IN SERVERSCRIPTSERVICE. AND PUT THESE SCRIPTS IN THERE.

This discussion is preserved as it was. New answers, comments, and votes are closed.