Help with "Attempt to call a nil value" in the output

Hi Guys, So I’m having a problem with my ax script that in the output says “Attempt to call a nill value”
I appreciate your Help

My Ax script:

sorry if this topic has already been done

Could you be kind and give us the script typed or in better quality?

1 Like

Here are

TreeLife local = workspace.Tree1.BillboardGui.Hits.Value

Local tool = script.Parent

local damage = script.Parent.Damage.Value

local Touched = game.ReplicatedStorage.Touched

Tool.Equipped: Connect (function (Mouse)

Mouse.Button1Down: Connect (function ()

ReplicatedStorage = local game: GetService (“ReplicatedStorage”)

local remoteEvent = ReplicatedStorage: WaitForChild (“Touched”)

TreeLife = TreeLife -Damage


Since the TreeLife variable is a number, and not the TreeLife object itself, when you subtract it, it’s only effecting the variable.

Try: local TreeLife = workspace.Tree1.BillboardGui.Hits
Instead of: local TreeLife = sworkspace.Tree1.BillboardGui.Hits.Value


try: TreeLife.Value = TreeLife.Value - Damage
instead of: TreeLife = TreeLife - Damage

Ok i Will try this after, i am on phone now

Is Happening the same error

Here is a photo of my explorer

For the first line try:

local TreeLife = workspace:WaitForChild("Tree1"):WaitForChild("BillboardGui"):WaitForChild("Hits")

Other than that check for typos.

Is happening the same error ,I think the error are in the function

On which line is the error occurring?


local Damage = script.Parent.Damage.Value


local Damage = script.Parent.Damage


Apparently the error is on the ninth line, I put several “print” in the script then it stopped on the ninth line.
or it may be that being in the variables

Thank you very much to everyone who helped, I managed to make a script that will be working with a little bit of everything you guys told me thank you very much