Answered by
5 years ago Edited 5 years ago
Well, You at least took the effort to do some research.. You're going to have to make use of Variables, Math, Events, Functions, and Connections.
Usually people use local scripts for tools but if we want to make an actual change to a value in leaderstats then I recommend the use of a server script.
We're going to make a tool that add 1 to a leaderstats value then the tool disappears.
05 | local tool = script.Parent |
09 | tool.Activated:Connect( function () |
11 | local character = tool.Parent |
12 | local players = game:GetService( "Players" ) |
13 | local player = players:GetPlayerFromCharacter(character) |
14 | local leaderstats = player.leaderstats |
15 | local currency = leaderstats.Money |
18 | currency.Value = currency.Value + addition |
Of course.. This script may error in certain circumstances.. But that's for the better. So you can observe, problem-solve, and understand the errors.