local combat = {} function combat.Main(weld, Service, Stand, Anim, char, current) local info = TweenInfo.new(0.5) local goal = {} goal.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame) goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(0,0,-3)) local tween = Service:Create(weld, info, goal) tween:Play() local Animation = Stand.AnimationController:LoadAnimation(Anim) Animation:Play() Animation.Stopped:Connect(function() local goal2 = {} goal2.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame) goal2.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(-3, 1.5, 3)) local back = Service:Create(weld, info, goal2) back:Play() end) local hitbox = Instance.new("Part", Stand) hitbox.Anchored = false hitbox.CanCollide = false hitbox.Size = char.HumanoidRootPart.Size hitbox.CFrame = Stand.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2.5) hitbox.Transparency = 1 local hitboxWeld = Instance.new("ManualWeld") hitboxWeld.Name = "HitboxWeld" hitboxWeld.Part0 = hitbox hitboxWeld.Part1 = Stand.HumanoidRootPart hitboxWeld.C0 = hitbox.CFrame:ToObjectSpace(Stand.HumanoidRootPart.CFrame) hitboxWeld.Parent = weld.Part0 hitbox.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if not hit:IsDescendantOf(char) then local enemyHum = hit.Parent:FindFirstChild("Humanoid") if current == 3 then enemyHum:TakeDamage(5) else enemyHum:TakeDamage(2) end hitbox:Destroy() end end end) end
Output:ServerScriptService.StandHandler.Combat:7: attempt to index nil with 'Part0'
I tried to local it or delete it but nothing works, any help would be great.
I think the Part0 of the weld wasn't set to any part. Have you set Part0 of the weld to any part before running the function?