Hi I am new to scripting and have tried everything and still I am not able to. How can I make that with every win 20 points are added instead of copying all the time and pasting.
if Wins == 1 then
player.leaderstats.Points.Value = player.leaderstats.Points.Value = 20
end
if Wins == 2 then
player.leaderstats.Points.Value = player.leaderstats.Points.Value = 40
end
if Wins == 3 then
player.leaderstats.Points.Value = player.leaderstats.Points.Value = 60
end
With this code you have it every win you get 20 x how many wins you get. What you should do is make wins a Leaderstat called âWinsâ and use this script (Put in StarterPlayer):
local leaderstats = script.Parent:WaitForChild("leaderstats")
local Points = leaderstats:WaitForChild("Points")
local Wins = leaderstats:WaitForChild("Wins")
currentwins = Wins.Value
Wins.Changed:Connect(function()
if Wins.Value > currentwins then
currentwins = Wins.Value
Points.Value = Points.Value + 20
end
end)