Hello everyone, I'm trying to make gui stats and when you mine some ores, then it should add certain stats and amount to gui's like iron, silver etc.
Here is script from adamant gui:
local Player = game.Players.LocalPlayer
local stats = Player:WaitForChild("leaderstats")
local adamant = stats:WaitForChild("Adamant")
script.Parent.Text = " "..adamant.Value
function PointChange()
script.Parent.Text = " "..adamant.Value
end
adamant.Changed:connect(PointChange)
Here is script from pickaxe:
wait(1)
------------------------
axelvl = 1 --This is the damage given to the tree.
treeMoney = math.random(1, 5)
resettime = 1 --this is how long it takes after the axe hit a tree until it works again. Avoid setting it to 0
------------------------
Tool = script.Parent
ting = 0 --this is my debounce
function hit()
print("hitting")
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
hit()
Tool.Enabled = true
end
function onTouched(hitt)
-- print("touched something")
if ting == 0 then
ting = 1
if hitt.Parent.Name == "Copper" or "Iron" or "Silver" or "Emerald" or "Ruby" or "Sapphire" or "Adamant" then
-- print("touched tree")
local user = game.Players:findFirstChild(Tool.Parent.Name) --find the player that carries the axe for later moneygiving
hitt.Parent.hit.Value = hitt.Parent.hit.Value - axelvl --deal damage to the tree
if hitt.Parent.hit.Value < 1 and hitt.Parent.Timber.Value == 0 then --check if the tree is felled
local stats = user:FindFirstChild("leaderstats")
if (stats ~= nil) then
local score = stats:FindFirstChild("Copper", "Iron", "Silver", "Emerald", "Ruby", "Sapphire", "Adamant")
if (score ~= nil) then
score.Value = score.Value + treeMoney
end
end
hitt.Parent.Timber.Value = 1 --this declares the tree "felled" and makes sure nobody else can get money from it
wait(resettime)
else
wait(1)
end
end
ting = 0
end
end
Tool.Activated:connect(onActivated)
connection = Tool.Handle.Touched:connect(onTouched)
Any question write in comments, i'll try explain. My english is bad, so sorry.

7 comments
I have a serious issue with helping you get a solution with this, which is that it looks like it came from a free model and therefore you have no idea how it works. Learn the language and how everything works, and then come back.
Plus it's a lot of code, just post the snippet you're having problems with.
Sorry, but this is an axe script, not a pick-axe script. Used for felling trees. I suggest finding another free model.
It's kind of self-explanitory by the fact it says on line 3 "Damage given to the tree"... This has nothing to do with mining ores and adding stats to a leaderboard. I feel you're asking a question but because you've not tried yourself you've gone and got a freemodel which you have no idea on how it works..
Did you actually make this? If so, you should understand it...
http://www.roblox.com/Alpha-Axe-item?id=335676806
I didn't made this.. becouse i tried to make something like this . but didn't work. Yes, i tried a lot with this, but all my changing don't work correctly. Sometimes work, but only model dissapear.