Instance.new object being nil

Hello, I’ve been trying to script a combat with a part created by Instance.new being a hitbox, however it keeps making an error saying “Attemp to index nil with positon”. An answer would be greatly appreciated.

--replicatedStorage
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local debrisService = game:GetService("Debris")
local combatEvent = ReplicatedStorage.RemoteEvent.Combat
-- hit box

combatEvent.OnServerEvent:Connect(function(player,combo,damage)
	--variable
	local character = player.Character
	local humanoid = character:WaitForChild("Humanoid")
	local cooldown = false
	--animation
	local punchanim1 = humanoid:LoadAnimation(script.Punch1)
	local punchanim2 = humanoid:LoadAnimation(script.Punch2)
	local punchanim3 = humanoid:LoadAnimation(script.Punch3)
	local punchanim4 = humanoid:LoadAnimation(script.Punch4)
	local punchanim5 = humanoid:LoadAnimation(script.Punch5)
	--
	local rightHand = character:FindFirstChild("RightHand")
	local leftHand = character:FindFirstChild("LeftHand")
	if combo == 1 then
		
		local punchHitbox = Instance.new("Part")
		punchHitbox.Transparency = 1
		punchHitbox.CanCollide = false
		punchHitbox.Parent = character
		punchHitbox.Name = "hitbox"
		local Weld = Instance.new("ManualWeld")
		Weld.Part0 = punchHitbox
		punchHitbox.Position = rightHand.Position
		Weld.Part1 = character:WaitForChild("RightHand")
		Weld.C0 = punchHitbox.CFrame:inverse() * character:WaitForChild("RightHand").CFrame
		Weld.Parent = punchHitbox
		punchanim1:Play()
             punchHitbox.Touched:Connect(function(Hit)
			if Hit.Parent == character or Hit.Parent.Parent == character then
				return
			elseif Hit.Parent:FindFirstChild("Dodge") or Hit.Parent.Parent:FindFirstChild("Dodge") then
				local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
				
				if Humanoid then
					local dodging = Humanoid:LoadAnimation(script.Block)
					dodging:Play()
					punchHitbox:Destroy()
				end
			elseif Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid") then
				local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
				
				if Humanoid and not Humanoid:FindFirstChild("Attacker") then
					local Attacker = Instance.new("ObjectValue",Humanoid)
					Attacker.Name = "Attacker"
					Attacker.Value = player
					debrisService:AddItem(Attacker,.5)
					
					Humanoid:TakeDamage(damage)
				end
			end
		end)
		wait(2)
		punchHitbox:Destroy()
    end
end)

Well I assume you’re talking about “RightHand”. So

local rightHand = character:FindFirstChild("RightHand")

Are you sure RightHand is actually a child of character? it’s not finding it.

Well, where’s the error?:confused:

Worked, Thank you so much. I appreciate it