So i have a value which is called strength and every time you click it picks a random number from 1 to 10 how would i make it change the text to how much it upgraded by when it picks a random number from 1 to 10 for example if it upgrades by +3 it would say +3 on the text label this is the code
game.Players.LocalPlayer.leaderstats.Strength.Value = game.Players.LocalPlayer.leaderstats.Strength.Value + math.random(1,script.Parent.Handle.Value.Value)
I would appreciate help thanks!
I noticed that you were changing the leaderstats values with a localscript. I'm hoping this is intentional, because that will not work with FilteringEnabled servers. Assuming this is intentional, here's how you would do it.
You'll want to have a PlayerGui with a TextLabel in it already set up, adjust the variables below to make it work for your use case.
local player = game.Players.LocalPlayer -- This just makes it easier to script. local textlabel = player.PlayerGui.MYGUI.MYTEXTLABEL -- You replace this of course. local value = math.random(1,script.Parent.Handle.Value.Value) -- Store your value in a variable. player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + value -- Your code. textlabel.Text = "+"..value