MouseButton Click doesnt work clearly

When joining and clicking on some parts some parts dont get registered when its being clicked by the mouse idk why
https://gyazo.com/3cc34442f722206ecd0f3817410b4638
heres the script :

USI.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
	local distance = (script.Parent.Parent.HumanoidRootPart.Position - mouse.Hit.p).Magnitude
	if distance <= 5 then
	if script.Parent.Parent.Resting.Value == true then
		return
	end
	if db == true then
		return
	end
	if script.Parent.Parent.Selected.Value == false then
		return
	end
		if mouse.Target.Name == "Land" then
			if mouse.Target:FindFirstChild("Scout") then
				return
			end

			script.RemoteEvent:FireServer("Move",mouse.Target:FindFirstChild("Pos"))

			local Part = Instance.new("Part")
			Part.Parent = mouse.Target:FindFirstChild("Pos")
			Part.CFrame = mouse.Target:FindFirstChild("Pos").CFrame
			Part.Material = Enum.Material.Neon
			Part.BrickColor = BrickColor.new("Lime green")
			Part.Size = Vector3.new(0.1, 3, 0.1)
			local tween = tweenService:Create(
				Part, -- instance
				TweenInfo.new(
					0.4, 
					Enum.EasingStyle.Linear,
					Enum.EasingDirection.In,
					0, 
					false, 
					0 
				),
				{Size = Vector3.new(0.6, 3, 0.6),Transparency = 1}

				-- properties.. {Size = Vector3.new(30, 30, 30), Position = ..}
			)
			tween:Play()
			wait(0.4)
			Part:Destroy()
		end
		end	
	end	
end)```
2 Likes