Attempt to index nil with 'parent'

yes, i realised in the veriable it is .value so i changed that but it is still not working

.Parent mean go up one place in the directory.

So is there a .Parent.Parent.damage?

Count each step out of the script as a .Parent.

With your given path the damage should be here:

Screen Shot 2024-05-05 at 6.03.29 PM
Screen Shot 2024-05-05 at 6.03.35 PM

it is located here
image

how would i fix it then, because if it move it up in it then my axe in starter player would not work.

It looks like the right pathway,

Maybe try reworking your original script that clones to tool into the backpack.

I noticed you cloned it twice. Maybe something like:

local rp = game:GetService("ReplicatedStorage")
local axe = rp:WaitForChild("Axes"):WaitForChild("Diamondaxe"):WaitForChild("Axe")
local plr = game:GetService("Players")
local player = plr.LocalPlayer

local function GiveTool()
	local newaxe = axe:Clone()
	newaxe.Parent = player.Backpack
end

local function ClearTools()
	for _, child in pairs(player.Character:GetChildren()) do
		if child:IsA("Tool") then 
			child:Destroy() 
		end
	end
	for _, child in pairs(player.Backpack:GetChildren()) do
		if child:IsA("Tool") then 
			child:Destroy()
		end
	end
	task.wait()
end

script.Parent.MouseButton1Click:Connect(function()
	ClearTools()
	GiveTool()
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.