Hey There, i've spent hours researching the web and trying things but still cant learn about functions i need my tool to add a point to my stats when it is used any help is appreciated thanks
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.
-- Server Script -- -- Variables local tool = script.Parent -- defining tool -- Events/Connections tool.Activated:Connect(function() -- tool "Activated" Event local character = tool.Parent -- defining character local players = game:GetService("Players") -- defining players local player = players:GetPlayerFromCharacter(character) -- defining player local leaderstats = player.leaderstats -- defining leaderstats local currency = leaderstats.Money -- defining currency local addition = 1 -- defining addition currency.Value = currency.Value + addition -- Adding 1 to Currency end)
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.