I am making a card game where player's card are based on the number a child in leaderstats, but my problem is that this script adds 1 to every value instead of only one random value. Here is the code:
script.Parent.MouseButton1Click:connect(function()
wait(0.05)
script.Parent.Selectable = false
wait(1)
local text = script.Parent.Message.Text
text = "Randomizing Prize."
wait(1)
text = "Randomizing Prize.."
wait(1)
text = "Randomizing Prize..."
wait(1)
text = "Randomizing Prize."
wait(1)
text = "Randomizing Prize.."
wait(1)
text = "Randomizing Prize..."
wait(1)
text = "Randomizing Prize."
wait(1)
text = "Randomizing Prize.."
wait(1)
text = "Randomizing Prize..."
wait(1)
text = "Randomizing Prize."
wait(1)
text = "Randomizing Prize.."
wait(1)
text = "Randomizing Prize..."
wait(1)
text = "Randomizing Prize."
wait(1)
text = "Randomizing Prize.."
wait(1)
text = "Randomizing Prize..."
wait(1)
text = "Randomizing Prize."
wait(1)
text = "Randomizing Prize.."
wait(1)
text = "Randomizing Prize..."
local children = game.Players.LocalPlayer.leaderstats:GetChildren()
for i = 1, #children do
children[i].Value = children[i].Value + 1
end
end)

5 comments
The for loop at the end adds 1 to each of the leaderstats
I don't know how to make it only choose one. That is the question.
Tell us which one you want to add to
A random child of leaderstats
use random.math